feat: target memory sync event replay
This commit is contained in:
@@ -29,7 +29,9 @@ class MemorySyncOutboxWorker:
|
|||||||
self.handlers = handlers
|
self.handlers = handlers
|
||||||
self.session_factory = session_factory
|
self.session_factory = session_factory
|
||||||
|
|
||||||
async def run_once(self, *, target_store: str | None = None) -> bool:
|
async def run_once(
|
||||||
|
self, *, target_store: str | None = None, event_uuid: str | None = None
|
||||||
|
) -> bool:
|
||||||
"""领取并处理一条到期事件;没有可处理事件时返回 False。"""
|
"""领取并处理一条到期事件;没有可处理事件时返回 False。"""
|
||||||
if not self.handlers:
|
if not self.handlers:
|
||||||
return False
|
return False
|
||||||
@@ -42,6 +44,8 @@ class MemorySyncOutboxWorker:
|
|||||||
]
|
]
|
||||||
if target_store is not None:
|
if target_store is not None:
|
||||||
conditions.append(MemorySyncOutbox.target_store == target_store)
|
conditions.append(MemorySyncOutbox.target_store == target_store)
|
||||||
|
if event_uuid is not None:
|
||||||
|
conditions.append(MemorySyncOutbox.event_uuid == event_uuid)
|
||||||
event = await session.scalar(
|
event = await session.scalar(
|
||||||
select(MemorySyncOutbox)
|
select(MemorySyncOutbox)
|
||||||
.where(*conditions)
|
.where(*conditions)
|
||||||
|
|||||||
Reference in New Issue
Block a user