feat(conversations,jobs): a manual run of the rotation job rotates the master now

This commit is contained in:
hh committed 2026-10-19 13:51:15 +02:00
1 parent 7b36cb2156
commit 8f26263d4a
3 files changed
+25 -4

No files matched your search

+12 -2
View File
@@ -77,9 +77,19 @@ class Rotation:
out.append((master, reason))
return out
async def tick(self, now: datetime | None = None) -> list[Conversation]:
async def tick(
self, now: datetime | None = None, *, force: str | None = None
) -> list[Conversation]:
"""Rotate the masters that are due; ``force`` rotates every open master."""
rotated: list[Conversation] = []
for master, reason in await self.due(now):
if force:
due = [
(m, force)
for m in await self._conversations.find(kind="master", status="open")
]
else:
due = await self.due(now)
for master, reason in due:
new = await self.rotate(master, reason)
if new is not None:
rotated.append(new)