Skip to content

Commit 10f71da

Browse files
committed
fix: retry update_processed_heads on transient failure (CM-1318)
Signed-off-by: Uroš Marolt <uros@marolt.me>
1 parent 0268e9d commit 10f71da

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • services/apps/mailing_list_integration/src/crowdmail/database

services/apps/mailing_list_integration/src/crowdmail/database/crud.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,18 @@ async def get_list_integration_info(list_id: str) -> dict | None:
210210
return await fetchrow(sql_query, (list_id,))
211211

212212

213+
@retry(
214+
stop=stop_after_attempt(3),
215+
wait=wait_fixed(1),
216+
reraise=True,
217+
)
213218
async def update_processed_heads(list_id: str, heads: dict) -> None:
219+
# Retried on any failure: activities from this flush are already queued
220+
# (DB rows written, Kafka published) by the time this runs, so a transient
221+
# failure here must not fail the whole run — that would leave the head
222+
# un-advanced and the next attempt re-reading + re-queueing the same
223+
# commits as duplicate Kafka work for the same resultIds.
224+
#
214225
# Merge (||) instead of replace: if stuck-reclaim ever lets two workers
215226
# process the same list concurrently, a slower worker's flush only
216227
# touches the shard keys it actually recomputed, instead of overwriting

0 commit comments

Comments
 (0)