Skip to content

Commit 1dcbd8b

Browse files
committed
fixed issue with flushing bucket before it's ready
1 parent fb945c2 commit 1dcbd8b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/howtos/examples/ProvisioningResourcesBuckets.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
* the License.
1313
*/
1414

15+
import java.time.Duration;
16+
1517
import com.couchbase.client.core.error.BucketExistsException;
18+
import com.couchbase.client.java.Bucket;
1619
import com.couchbase.client.java.Cluster;
1720
import com.couchbase.client.java.manager.bucket.BucketManager;
1821
import com.couchbase.client.java.manager.bucket.BucketSettings;
@@ -44,6 +47,10 @@ public static void main(String[] args) {
4447
System.out.println("Bucket already exists");
4548
}
4649
// end::createBucket[]
50+
51+
// Wait until bucket is created before trying to flush it
52+
Bucket bucket = cluster.bucket("hello");
53+
bucket.waitUntilReady(Duration.ofSeconds(10));
4754
}
4855

4956
{
@@ -59,6 +66,7 @@ public static void main(String[] args) {
5966
{
6067
System.out.println("[flushBucket]");
6168

69+
6270
// tag::flushBucket[]
6371
bucketMgr.flushBucket("hello");
6472
// end::flushBucket[]

0 commit comments

Comments
 (0)