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

Use exists_ok in error handling instead of pre-condition #44

Closed bmario closed 2 years ago

bmario commented 2 years ago

In a race condition, the _exists() might return False, but until the time the PUT is done, the database might be created from another context. Hence, just drop the existence check and unconditionally try to create the database.

Fixes #42

codecov[bot] commented 2 years ago

Codecov Report

Merging #44 (2c18082) into master (8ab0f62) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #44   +/-   ##
=======================================
  Coverage   97.10%   97.10%           
=======================================
  Files          13       13           
  Lines         932      932           
=======================================
  Hits          905      905           
  Misses         27       27           
Impacted Files Coverage Δ
aiocouch/couchdb.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8ab0f62...2c18082. Read the comment docs.