metricq / aiocouch

🛋 An asynchronous client library for CouchDB 2.x and 3.x
https://aiocouch.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
29 stars 10 forks source link

Race condition with couchdb.create exists_ok=True #42

Closed starlord-daniel closed 2 years ago

starlord-daniel commented 2 years ago

In our project we found that if you are calling the couchdb.create method with exists_ok set to True, then it could happen, that you still get the following error:

raise exception_type(message.format(**message_input)) from exception
aiocouch.exception.PreconditionFailedError: Database already exists

This should not happen, as we are already ok with the database existing.

I've will open a PR to address this and link it HERE Please give feedback, if that solution follows the packages approach and works for you.

bmario commented 2 years ago

Thanks for the report and PR, I've worked on a solution including more tests in parallel though.