fix(id_order): reserve startup when resume resolves an unrecorded uuid (Issue #63)
This commit is contained in:
1 parent
c747374aa6
commit
d115bf7156
2 files changed
+72
-13
No files matched your search
@@ -122,12 +122,14 @@ def blockers(state: Dict[str, Any], cwd: str, agent: str, me: str,
|
||||
prev_epoch = int(m.get("prev_epoch") or 0)
|
||||
prev_end_epoch = int(m.get("prev_end_epoch") or 0)
|
||||
|
||||
pinned_for_attempt = bool(cur_own) and (
|
||||
cur_own != prev_own
|
||||
or (status == "running" and row_epoch > prev_epoch)
|
||||
)
|
||||
if pinned_for_attempt:
|
||||
continue
|
||||
if status == "running":
|
||||
pinned_for_attempt = bool(cur_own) and (
|
||||
cur_own != prev_own or row_epoch > prev_epoch
|
||||
)
|
||||
if not pinned_for_attempt:
|
||||
found.append(m_sess)
|
||||
found.append(m_sess)
|
||||
else:
|
||||
ended_after_attempt = (
|
||||
end_epoch > max(m_at, prev_end_epoch)
|
||||
@@ -231,14 +233,15 @@ def wait(cwd: str, agent: str, session: str, owner_pid: int,
|
||||
markers = _read_and_prune_markers(dpath, session, is_alive=is_alive)
|
||||
blks = blockers(state, cwd, agent, session, markers, is_alive=is_alive)
|
||||
if not blks:
|
||||
if not uuid and owner_pid and owner_pid > 0:
|
||||
prev_row = next(
|
||||
(
|
||||
s for s in (state.get("herdr_sessions") or [])
|
||||
if isinstance(s, dict) and s.get("name") == session
|
||||
),
|
||||
None,
|
||||
)
|
||||
prev_row = next(
|
||||
(
|
||||
s for s in (state.get("herdr_sessions") or [])
|
||||
if isinstance(s, dict) and s.get("name") == session
|
||||
),
|
||||
None,
|
||||
)
|
||||
already_recorded = bool(uuid) and own_id(prev_row, agent) == uuid
|
||||
if not already_recorded and owner_pid and owner_pid > 0:
|
||||
write_marker(dpath, session, owner_pid, cwd, agent, prev_row=prev_row)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in new issue
Block a user