update_manager: don't allow repo init waiters to return success on a failure
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
e69ac489c7
commit
f339aa7454
|
@ -847,6 +847,7 @@ class GitRepo:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.init_condition = None
|
self.init_condition = None
|
||||||
|
self.initialized = False
|
||||||
self.git_operation_lock = Lock()
|
self.git_operation_lock = Lock()
|
||||||
self.fetch_timeout_handle = None
|
self.fetch_timeout_handle = None
|
||||||
self.fetch_input_recd = False
|
self.fetch_input_recd = False
|
||||||
|
@ -855,7 +856,9 @@ class GitRepo:
|
||||||
if self.init_condition is not None:
|
if self.init_condition is not None:
|
||||||
# No need to initialize multiple requests
|
# No need to initialize multiple requests
|
||||||
await self.init_condition.wait()
|
await self.init_condition.wait()
|
||||||
return
|
if self.initialized:
|
||||||
|
return
|
||||||
|
self.initialized = False
|
||||||
self.init_condition = Condition()
|
self.init_condition = Condition()
|
||||||
self.git_messages.clear()
|
self.git_messages.clear()
|
||||||
try:
|
try:
|
||||||
|
@ -936,6 +939,8 @@ class GitRepo:
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.exception(f"Git Repo {self.alias}: Initialization failure")
|
logging.exception(f"Git Repo {self.alias}: Initialization failure")
|
||||||
raise
|
raise
|
||||||
|
else:
|
||||||
|
self.initialized = True
|
||||||
finally:
|
finally:
|
||||||
self.init_condition.notify_all()
|
self.init_condition.notify_all()
|
||||||
self.init_condition = None
|
self.init_condition = None
|
||||||
|
@ -943,6 +948,9 @@ class GitRepo:
|
||||||
async def wait_for_init(self):
|
async def wait_for_init(self):
|
||||||
if self.init_condition is not None:
|
if self.init_condition is not None:
|
||||||
await self.init_condition.wait()
|
await self.init_condition.wait()
|
||||||
|
if not self.initialized:
|
||||||
|
raise self.server.error(
|
||||||
|
f"Git Repo {self.alias}: Initialization failure")
|
||||||
|
|
||||||
async def update_repo_status(self):
|
async def update_repo_status(self):
|
||||||
async with self.git_operation_lock:
|
async with self.git_operation_lock:
|
||||||
|
|
Loading…
Reference in New Issue