Skip to content

Commit 25e459a

Browse files
committed
Guard against async creation of nodes DB
When a new CouchDB comes up the network interface is live before the nodes database is created. We could incorporate a check for the existence of the database into the readinessProbe on the CouchDB container, but we can also simply be defensive here.
1 parent b575c67 commit 25e459a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mem3_helper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ def connect_the_dots(names, retries=5):
3535
doc = {}
3636
try:
3737
r = requests.put(uri, data = json.dumps(doc))
38+
if r.status_code == 404:
39+
print('CouchDB nodes DB does not exist yet')
40+
time.sleep(5)
41+
connect_the_dots(names, retries - 1)
3842
print(name, r.status_code)
3943
except requests.exceptions.ConnectionError:
4044
print('CouchDB admin port not up yet')

0 commit comments

Comments
 (0)