[#25] selector: Remove next object timeout

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
pull/86/head
Dmitrii Stepanov 2023-07-20 15:01:57 +03:00
parent 0dc0ba1704
commit 704c0f06bc
9 changed files with 15 additions and 21 deletions

View File

@ -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
}

View File

@ -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.

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;