fix message channels stuck in ONGOING (#17492)
`markAsMessagesListFetchOngoing()` was missing `syncStageStartedAt`
causing stuck channels to be never recovered.
Regression was caused by commit
[68a9ef57f0](https://github.com/twentyhq/twenty/commit/68a9ef57f0)
This commit is contained in:
+1
-4
@@ -54,10 +54,7 @@ export class CalendarOngoingStaleJob {
|
||||
});
|
||||
|
||||
for (const calendarChannel of calendarChannels) {
|
||||
if (
|
||||
calendarChannel.syncStageStartedAt &&
|
||||
isSyncStale(calendarChannel.syncStageStartedAt)
|
||||
) {
|
||||
if (isSyncStale(calendarChannel.syncStageStartedAt)) {
|
||||
await this.calendarChannelSyncStatusService.resetSyncStageStartedAt(
|
||||
[calendarChannel.id],
|
||||
workspaceId,
|
||||
|
||||
+7
-1
@@ -1,6 +1,12 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { CALENDAR_IMPORT_ONGOING_SYNC_TIMEOUT } from 'src/modules/calendar/calendar-event-import-manager/constants/calendar-import-ongoing-sync-timeout.constant';
|
||||
|
||||
export const isSyncStale = (syncStageStartedAt: string): boolean => {
|
||||
export const isSyncStale = (syncStageStartedAt?: string | null): boolean => {
|
||||
if (!isDefined(syncStageStartedAt)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const syncStageStartedTime = new Date(syncStageStartedAt).getTime();
|
||||
|
||||
if (isNaN(syncStageStartedTime)) {
|
||||
|
||||
+1
@@ -182,6 +182,7 @@ export class CalendarChannelSyncStatusService {
|
||||
await calendarChannelRepository.update(calendarChannelIds, {
|
||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENTS_IMPORT_ONGOING,
|
||||
syncStatus: CalendarChannelSyncStatus.ONGOING,
|
||||
syncStageStartedAt: new Date().toISOString(),
|
||||
});
|
||||
}, authContext);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user