Improvement on messaging (#16351)

In this PR:
- change messaging / calendar stale duration check to 30minutes (cron is
running every 1h, duration check was 1h, so evaluation was flaky)
- when temporary error (throttling), preserve syncStageStartedAt as this
is necessary to assess exponential throttling
This commit is contained in:
Charles Bochet
2025-12-05 00:04:07 +01:00
committed by GitHub
parent 2803292521
commit 10b5e156e5
19 changed files with 191 additions and 96 deletions
@@ -35,6 +35,7 @@ export class MessageChannelSyncStatusService {
public async scheduleMessageListFetch(
messageChannelIds: string[],
workspaceId: string,
preserveSyncStageStartedAt: boolean = false,
) {
if (!messageChannelIds.length) {
return;
@@ -48,12 +49,14 @@ export class MessageChannelSyncStatusService {
await messageChannelRepository.update(messageChannelIds, {
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
...(!preserveSyncStageStartedAt ? { syncStageStartedAt: null } : {}),
});
}
public async scheduleMessagesImport(
messageChannelIds: string[],
workspaceId: string,
preserveSyncStageStartedAt: boolean = false,
) {
if (!messageChannelIds.length) {
return;
@@ -67,6 +70,7 @@ export class MessageChannelSyncStatusService {
await messageChannelRepository.update(messageChannelIds, {
syncStage: MessageChannelSyncStage.MESSAGES_IMPORT_PENDING,
...(!preserveSyncStageStartedAt ? { syncStageStartedAt: null } : {}),
});
}