add retry count

This commit is contained in:
Evan
2025-12-07 16:08:08 +00:00
parent c8a9794b0f
commit 87a139d53b
2 changed files with 6 additions and 1 deletions

View File

@@ -95,6 +95,7 @@ class Master:
self._tg.cancel_scope.cancel()
async def _command_processor(self) -> None:
retry_num = 0
with self.command_receiver as commands:
async for forwarder_command in commands:
try:
@@ -186,8 +187,11 @@ class Master:
command.finished_command_id
]
case RequestEventLog():
retry_num += 1
# We should just be able to send everything, since other buffers will ignore old messages
for i in range(command.since_idx, len(self._event_log)):
ev = self._event_log[i]
ev._retry = retry_num
await self._send_event(
IndexedEvent(idx=i, event=self._event_log[i])
)

View File

@@ -22,7 +22,8 @@ class EventId(Id):
class BaseEvent(TaggedModel):
event_id: EventId = Field(default_factory=EventId)
# Internal, for debugging. Please don't rely on this field for anything!
_master_time_stamp: None | datetime = None
_master_time_stamp: datetime | None = None
_retry: int | None = None
class TestEvent(BaseEvent):