Skip to content

Commit

Permalink
fix: agent startup error due to UnboundLocalError in dumping the la…
Browse files Browse the repository at this point in the history
…st registry (#452)
  • Loading branch information
adrysn committed Jun 8, 2022
1 parent 9d3e226 commit e10d0f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/452.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Agent startup error due to `UnboundLocalError` of `now` variable in dumping the last registry.
3 changes: 2 additions & 1 deletion src/ai/backend/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,8 @@ async def list_files(self, kernel_id: KernelId, path: str):
return await self.kernel_registry[kernel_id].list_files(path)

async def save_last_registry(self, force=False) -> None:
if (not force) and (now := time.monotonic() <= self.last_registry_written_time + 60):
now = time.monotonic()
if (not force) and (now <= self.last_registry_written_time + 60):
return # don't save too frequently
try:
ipc_base_path = self.local_config["agent"]["ipc-base-path"]
Expand Down

0 comments on commit e10d0f0

Please sign in to comment.