From 704c0f06bc5f450863a582a850746b30b0315bd8 Mon Sep 17 00:00:00 2001 From: Dmitrii Stepanov Date: Thu, 20 Jul 2023 15:01:57 +0300 Subject: [PATCH] [#25] selector: Remove next object timeout Signed-off-by: Dmitrii Stepanov --- internal/registry/obj_exporter.go | 2 +- internal/registry/obj_selector.go | 12 +++--------- scenarios/grpc.js | 4 ++-- scenarios/grpc_car.js | 4 ++-- scenarios/local.js | 2 +- scenarios/s3.js | 4 ++-- scenarios/s3_car.js | 4 ++-- scenarios/s3local.js | 2 +- scenarios/verify.js | 2 +- 9 files changed, 15 insertions(+), 21 deletions(-) diff --git a/internal/registry/obj_exporter.go b/internal/registry/obj_exporter.go index 675c192..73cda60 100644 --- a/internal/registry/obj_exporter.go +++ b/internal/registry/obj_exporter.go @@ -45,7 +45,7 @@ func (o *ObjExporter) ExportJSONPreGen(fileName string) error { var comma string for i := 0; i < count; i++ { - info := o.selector.NextObject(5) + info := o.selector.NextObject() if info == nil { break } diff --git a/internal/registry/obj_selector.go b/internal/registry/obj_selector.go index ffec259..5476a27 100644 --- a/internal/registry/obj_selector.go +++ b/internal/registry/obj_selector.go @@ -53,15 +53,9 @@ func NewObjSelector(registry *ObjRegistry, selectionSize int, filter *ObjFilter) // the following happens: // - a "new" next object is available; // - underlying registry context is done, nil objects will be returned on the -// currently blocked and every further NextObject calls; -// - timeoutSeconds elapsed, nil object will be returned. -func (o *ObjSelector) NextObject(timeoutSeconds int) *ObjectInfo { - select { - case <-time.After(time.Duration(timeoutSeconds) * time.Second): - return nil - case obj := <-o.objChan: - return obj - } +// currently blocked and every further NextObject calls. +func (o *ObjSelector) NextObject() *ObjectInfo { + return <-o.objChan } // Count returns total number of objects that match filter of the selector. diff --git a/scenarios/grpc.js b/scenarios/grpc.js index b41c4ed..3bf351d 100644 --- a/scenarios/grpc.js +++ b/scenarios/grpc.js @@ -162,7 +162,7 @@ export function obj_read() { } if(obj_to_read_selector) { - const obj = obj_to_read_selector.nextObject(5); + const obj = obj_to_read_selector.nextObject(); if (!obj) { return; } @@ -185,7 +185,7 @@ export function obj_delete() { sleep(__ENV.SLEEP_DELETE); } - const obj = obj_to_delete_selector.nextObject(5); + const obj = obj_to_delete_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/grpc_car.js b/scenarios/grpc_car.js index 972cbf9..6271ec6 100644 --- a/scenarios/grpc_car.js +++ b/scenarios/grpc_car.js @@ -186,7 +186,7 @@ export function obj_read() { } if(obj_to_read_selector) { - const obj = obj_to_read_selector.nextObject(5); + const obj = obj_to_read_selector.nextObject(); if (!obj) { return; } @@ -209,7 +209,7 @@ export function obj_delete() { sleep(__ENV.SLEEP_DELETE); } - const obj = obj_to_delete_selector.nextObject(5); + const obj = obj_to_delete_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/local.js b/scenarios/local.js index c56d2bb..01496a4 100644 --- a/scenarios/local.js +++ b/scenarios/local.js @@ -142,7 +142,7 @@ export function obj_read() { } export function obj_delete() { - const obj = obj_to_delete_selector.nextObject(5); + const obj = obj_to_delete_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/s3.js b/scenarios/s3.js index 6e3a690..1568dc1 100644 --- a/scenarios/s3.js +++ b/scenarios/s3.js @@ -157,7 +157,7 @@ export function obj_read() { } if(obj_to_read_selector) { - const obj = obj_to_read_selector.nextObject(5); + const obj = obj_to_read_selector.nextObject(); if (!obj) { return; } @@ -181,7 +181,7 @@ export function obj_delete() { sleep(__ENV.SLEEP_DELETE); } - const obj = obj_to_delete_selector.nextObject(5); + const obj = obj_to_delete_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/s3_car.js b/scenarios/s3_car.js index 3ec5fa6..262e0fc 100644 --- a/scenarios/s3_car.js +++ b/scenarios/s3_car.js @@ -184,7 +184,7 @@ export function obj_read() { } if(obj_to_read_selector) { - const obj = obj_to_read_selector.nextObject(5); + const obj = obj_to_read_selector.nextObject(); if (!obj) { return; } @@ -208,7 +208,7 @@ export function obj_delete() { sleep(__ENV.SLEEP_DELETE); } - const obj = obj_to_delete_selector.nextObject(5); + const obj = obj_to_delete_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/s3local.js b/scenarios/s3local.js index 6d40f11..7eb960b 100644 --- a/scenarios/s3local.js +++ b/scenarios/s3local.js @@ -131,7 +131,7 @@ export function obj_write() { export function obj_read() { if(obj_to_read_selector) { - const obj = obj_to_read_selector.nextObject(5); + const obj = obj_to_read_selector.nextObject(); if (!obj) { return; } diff --git a/scenarios/verify.js b/scenarios/verify.js index 3bba4d2..da27fed 100644 --- a/scenarios/verify.js +++ b/scenarios/verify.js @@ -112,7 +112,7 @@ export function obj_verify() { sleep(__ENV.SLEEP); } - const obj = obj_to_verify_selector.nextObject(5); + const obj = obj_to_verify_selector.nextObject(); if (!obj) { log.info("All objects have been verified"); return;