Wait / check for scope/collection creation/ready?
mgroves opened this issue · 3 comments
It's possible that collections are not ready immediately after creation.
Add some code to check to make sure collection (and scope) is ready, before continuing?
Or investigate if there's an HTTP API endpoint to check for scope/collection readiness?
Perhaps use Polly for this? https://github.com/App-vNext/Polly
Per discussion with a Couchbase engineer, just about everything in Couchbase is async (which makes sense). Additionally, the index service needs time to discover the new collection. So, what probably needs to be done is either:
Create.Collection(...)
should wait/poll to see if collection existsCreate.Index(...)
should retry/wait/poll to see if collection exists
One, or the other, or both, that is the question.
And the same should apply for Create.Scope(...)
too, probably.
It might also be a good idea to add another fluent method to opt out of polling/waiting, which by default WILL poll, but can be changed. Maybe something like .Wait(bool)
or .Verify(bool)
which defaults to true if not explicitly set.
This seems to be working now; no intermittent failures (yet)