[MESSAGING] Calendar check syncStatus in jobs (#15658)

This commit is contained in:
neo773
2025-11-06 20:44:21 +05:30
committed by GitHub
parent dc57f00e26
commit 546fba7d05
4 changed files with 14 additions and 6 deletions
@@ -16,7 +16,10 @@ import {
CalendarRelaunchFailedCalendarChannelJob,
type CalendarRelaunchFailedCalendarChannelJobData,
} from 'src/modules/calendar/calendar-event-import-manager/jobs/calendar-relaunch-failed-calendar-channel.job';
import { CalendarChannelSyncStage } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
import {
CalendarChannelSyncStage,
CalendarChannelSyncStatus,
} from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
export const CALENDAR_RELAUNCH_FAILED_CALENDAR_CHANNELS_CRON_PATTERN =
'*/30 * * * *';
@@ -50,7 +53,7 @@ export class CalendarRelaunchFailedCalendarChannelsCronJob {
const schemaName = getWorkspaceSchemaName(activeWorkspace.id);
const failedCalendarChannels = await this.coreDataSource.query(
`SELECT * FROM ${schemaName}."calendarChannel" WHERE "syncStage" = '${CalendarChannelSyncStage.FAILED}'`,
`SELECT * FROM ${schemaName}."calendarChannel" WHERE "syncStage" = '${CalendarChannelSyncStage.FAILED}' AND "syncStatus" = '${CalendarChannelSyncStatus.FAILED_UNKNOWN}'`,
);
for (const calendarChannel of failedCalendarChannels) {
@@ -48,7 +48,8 @@ export class CalendarRelaunchFailedCalendarChannelJob {
if (
!calendarChannel ||
calendarChannel.syncStage !== CalendarChannelSyncStage.FAILED
calendarChannel.syncStage !== CalendarChannelSyncStage.FAILED ||
calendarChannel.syncStatus !== CalendarChannelSyncStatus.FAILED_UNKNOWN
) {
return;
}
@@ -12,7 +12,10 @@ import { MessageQueue } from 'src/engine/core-modules/message-queue/message-queu
import { MessageQueueService } from 'src/engine/core-modules/message-queue/services/message-queue.service';
import { WorkspaceEntity } from 'src/engine/core-modules/workspace/workspace.entity';
import { getWorkspaceSchemaName } from 'src/engine/workspace-datasource/utils/get-workspace-schema-name.util';
import { MessageChannelSyncStage } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity';
import {
MessageChannelSyncStage,
MessageChannelSyncStatus,
} from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity';
import {
MessagingRelaunchFailedMessageChannelJob,
type MessagingRelaunchFailedMessageChannelJobData,
@@ -50,7 +53,7 @@ export class MessagingRelaunchFailedMessageChannelsCronJob {
const schemaName = getWorkspaceSchemaName(activeWorkspace.id);
const failedMessageChannels = await this.coreDataSource.query(
`SELECT * FROM ${schemaName}."messageChannel" WHERE "syncStage" = '${MessageChannelSyncStage.FAILED}'`,
`SELECT * FROM ${schemaName}."messageChannel" WHERE "syncStage" = '${MessageChannelSyncStage.FAILED}' AND "syncStatus" = '${MessageChannelSyncStatus.FAILED_UNKNOWN}'`,
);
for (const messageChannel of failedMessageChannels) {
@@ -48,7 +48,8 @@ export class MessagingRelaunchFailedMessageChannelJob {
if (
!messageChannel ||
messageChannel.syncStage !== MessageChannelSyncStage.FAILED
messageChannel.syncStage !== MessageChannelSyncStage.FAILED ||
messageChannel.syncStatus !== MessageChannelSyncStatus.FAILED_UNKNOWN
) {
return;
}