5617 Create CalendarOngoingStaleCron Job (#6748)
Closes #5617 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -93,6 +93,20 @@ export class MessageChannelSyncStatusService {
|
||||
await this.scheduleFullMessageListFetch(messageChannelId);
|
||||
}
|
||||
|
||||
public async resetSyncStageStartedAt(messageChannelId: string) {
|
||||
const messageChannelRepository =
|
||||
await this.twentyORMManager.getRepository<MessageChannelWorkspaceEntity>(
|
||||
'messageChannel',
|
||||
);
|
||||
|
||||
await messageChannelRepository.update(
|
||||
{ id: messageChannelId },
|
||||
{
|
||||
syncStageStartedAt: null,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
public async markAsMessagesListFetchOngoing(messageChannelId: string) {
|
||||
const messageChannelRepository =
|
||||
await this.twentyORMManager.getRepository<MessageChannelWorkspaceEntity>(
|
||||
|
||||
@ -55,6 +55,10 @@ export class MessagingOngoingStaleJob {
|
||||
`Sync for message channel ${messageChannel.id} and workspace ${workspaceId} is stale. Setting sync stage to MESSAGES_IMPORT_PENDING`,
|
||||
);
|
||||
|
||||
await this.messagingChannelSyncStatusService.resetSyncStageStartedAt(
|
||||
messageChannel.id,
|
||||
);
|
||||
|
||||
switch (messageChannel.syncStage) {
|
||||
case MessageChannelSyncStage.MESSAGE_LIST_FETCH_ONGOING:
|
||||
await this.messageChannelSyncStatusService.schedulePartialMessageListFetch(
|
||||
|
||||
Reference in New Issue
Block a user