Skip to content

Commit 374c1c1

Browse files
committed
Fixing WorkLoadGenerate::run() - get_client_for_bucket() logic
1 parent b1f5d24 commit 374c1c1

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/main/java/couchbase/loadgen/WorkLoadGenerate.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,22 @@ else if(ops < dg.ws.ops/dg.ws.workers && flag) {
451451

452452
@Override
453453
public void run() {
454-
if (this.sdkClientPool != null)
455-
this.sdk = this.sdkClientPool.get_client_for_bucket(
456-
this.bucket_name, this.scope, this.collection);
454+
if (this.sdkClientPool != null) {
455+
while (this.sdk == null) {
456+
this.sdk = this.sdkClientPool.get_client_for_bucket(
457+
this.bucket_name, this.scope, this.collection);
458+
if (this.sdk == null) {
459+
try {
460+
TimeUnit.SECONDS.sleep(1);
461+
} catch (InterruptedException e) {
462+
logger.error("Interrupted while waiting for SDK client", e);
463+
Thread.currentThread().interrupt();
464+
this.result = false;
465+
return;
466+
}
467+
}
468+
}
469+
}
457470
try {
458471
this.actual_run();
459472
}

0 commit comments

Comments
 (0)