From c4e2332b831e6545308ceefc66fdb073f42dad4b Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 20 May 2023 19:29:32 +0700 Subject: [PATCH] fix startup race condition cluster health --- tubearchivist/config/management/commands/ta_connection.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tubearchivist/config/management/commands/ta_connection.py b/tubearchivist/config/management/commands/ta_connection.py index a6159b3c..86a3bd33 100644 --- a/tubearchivist/config/management/commands/ta_connection.py +++ b/tubearchivist/config/management/commands/ta_connection.py @@ -86,6 +86,8 @@ class Command(BaseCommand): continue if status_code and status_code == 200: + path = "_cluster/health?wait_for_status=yellow&timeout=30s" + _, _ = ElasticWrap(path).get() self.stdout.write( self.style.SUCCESS(" ✓ ES connection established") ) @@ -116,7 +118,7 @@ class Command(BaseCommand): return message = ( - " 🗙 ES connection failed. " + " 🗙 ES version check failed. " + f"Expected {self.MIN_MAJOR}.{self.MIN_MINOR} but got {version}" ) self.stdout.write(self.style.ERROR(f"{message}"))