Bucket creation callback

Hi,

I am trying to create some buckets, and then create a GSI index on one of them.

I noticed that I always get an “authentication error” on “get bucket” operation.
And then I realized that I need to wait a while after creating the bucket so that it finishes “warming up”.
So if i throw a Thread.Sleep(some seconds) before trying to to the “get bucket”, it works.

Is there a better way to know when the bucket is ready to be accessed?

@alon.schachter

I’ve monitored the REST endpoint /pools/default/buckets before, waiting for all nodes to show status of “healthy” for the bucket:

https://github.com/brantburnett/couchbasefakeit/blob/master/scripts/configure-node.sh#L69

However, I’ve also found that isn’t 100% accurate, as there are some other async processes of some kind still occurring. So I typically throw in an extra little wait afterwards, or I actually try to bootstrap the SDK and see if I can access the bucket I need to be 100% certain.

Brant

Thanks.

I would consider adding a synchronous option for creating buckets which would return only once the bucket is ready or adding a callback.