Remove old Calendar and Messaging partial/full sync stages (#15380)
Now that all existing and new workspaces have the following syncStage: - CALENDAR_EVENT_LIST_FETCH_PENDING - MESSAGE_LIST_FETCH_PENDING We can fully deprecate the old FULL_CALENDAR_EVENT_LIST_FETCH_PENDING and PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING (full vs partial is now directly inferred from the presence of a cursor)
This commit is contained in:
@@ -10,8 +10,6 @@ export enum CalendarChannelSyncStatus {
|
||||
|
||||
export enum CalendarChannelSyncStage {
|
||||
PENDING_CONFIGURATION = 'PENDING_CONFIGURATION',
|
||||
FULL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING', // WILL BE DEPRECATED
|
||||
PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING', // DEPRECATED
|
||||
CALENDAR_EVENT_LIST_FETCH_PENDING = 'CALENDAR_EVENT_LIST_FETCH_PENDING',
|
||||
CALENDAR_EVENT_LIST_FETCH_SCHEDULED = 'CALENDAR_EVENT_LIST_FETCH_SCHEDULED',
|
||||
CALENDAR_EVENT_LIST_FETCH_ONGOING = 'CALENDAR_EVENT_LIST_FETCH_ONGOING',
|
||||
|
||||
@@ -24,8 +24,6 @@ export enum MessageChannelSyncStatus {
|
||||
|
||||
export enum MessageChannelSyncStage {
|
||||
PENDING_CONFIGURATION = 'PENDING_CONFIGURATION',
|
||||
FULL_MESSAGE_LIST_FETCH_PENDING = 'FULL_MESSAGE_LIST_FETCH_PENDING', // WILL BE DEPRECATED
|
||||
PARTIAL_MESSAGE_LIST_FETCH_PENDING = 'PARTIAL_MESSAGE_LIST_FETCH_PENDING', // DEPRECATED
|
||||
MESSAGE_LIST_FETCH_PENDING = 'MESSAGE_LIST_FETCH_PENDING',
|
||||
MESSAGE_LIST_FETCH_SCHEDULED = 'MESSAGE_LIST_FETCH_SCHEDULED',
|
||||
MESSAGE_LIST_FETCH_ONGOING = 'MESSAGE_LIST_FETCH_ONGOING',
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ export const TwoConnectedAccounts: Story = {
|
||||
connectedAccountId:
|
||||
'20202020-954c-4d76-9a87-e5f072d4b7ef',
|
||||
contactAutoCreationPolicy: 'SENT',
|
||||
syncStage: 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING',
|
||||
syncStage: 'CALENDAR_EVENT_LIST_FETCH_PENDING',
|
||||
type: 'email',
|
||||
isContactAutoCreationEnabled: true,
|
||||
syncCursor: '1562764',
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ export const TwoConnectedAccounts: Story = {
|
||||
connectedAccountId:
|
||||
'20202020-954c-4d76-9a87-e5f072d4b7ef',
|
||||
contactAutoCreationPolicy: 'SENT',
|
||||
syncStage: 'FULL_MESSAGE_LIST_FETCH_PENDING',
|
||||
syncStage: 'MESSAGE_LIST_FETCH_PENDING',
|
||||
type: 'email',
|
||||
isContactAutoCreationEnabled: true,
|
||||
syncCursor: '1562764',
|
||||
@@ -122,7 +122,7 @@ export const TwoConnectedAccounts: Story = {
|
||||
connectedAccountId:
|
||||
'20202020-954c-4d76-9a87-e5f072d4b7ef',
|
||||
contactAutoCreationPolicy: 'SENT',
|
||||
syncStage: 'FULL_MESSAGE_LIST_FETCH_PENDING',
|
||||
syncStage: 'MESSAGE_LIST_FETCH_PENDING',
|
||||
type: 'email',
|
||||
isContactAutoCreationEnabled: true,
|
||||
syncCursor: '1562764',
|
||||
|
||||
+5
-12
@@ -17300,13 +17300,13 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
"isUnique": false,
|
||||
"createdAt": "2025-06-09T18:53:47.000Z",
|
||||
"updatedAt": "2025-06-09T18:53:47.000Z",
|
||||
"defaultValue": "'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING'",
|
||||
"defaultValue": "'CALENDAR_EVENT_LIST_FETCH_PENDING'",
|
||||
"options": [
|
||||
{
|
||||
"id": "a63c16e1-fe1e-40ff-9380-118f16b30a16",
|
||||
"color": "blue",
|
||||
"label": "Full calendar event list fetch pending",
|
||||
"value": "FULL_CALENDAR_EVENT_LIST_FETCH_PENDING",
|
||||
"value": "CALENDAR_EVENT_LIST_FETCH_PENDING",
|
||||
"position": 0
|
||||
},
|
||||
{
|
||||
@@ -18145,22 +18145,15 @@ export const mockedStandardObjectMetadataQueryResult: ObjectMetadataItemsQuery =
|
||||
"isUnique": false,
|
||||
"createdAt": "2025-06-09T18:53:47.000Z",
|
||||
"updatedAt": "2025-06-09T18:53:47.000Z",
|
||||
"defaultValue": "'FULL_MESSAGE_LIST_FETCH_PENDING'",
|
||||
"defaultValue": "'MESSAGE_LIST_FETCH_PENDING'",
|
||||
"options": [
|
||||
{
|
||||
"id": "60f0c071-4375-4e1c-ac0f-3b6c64cb35b3",
|
||||
"color": "blue",
|
||||
"label": "Full messages list fetch pending",
|
||||
"value": "FULL_MESSAGE_LIST_FETCH_PENDING",
|
||||
"label": "Messages list fetch pending",
|
||||
"value": "MESSAGE_LIST_FETCH_PENDING",
|
||||
"position": 0
|
||||
},
|
||||
{
|
||||
"id": "0728c8f0-8c9f-4a01-9ccc-d3ff68e64d12",
|
||||
"color": "blue",
|
||||
"label": "Partial messages list fetch pending",
|
||||
"value": "PARTIAL_MESSAGE_LIST_FETCH_PENDING",
|
||||
"position": 1
|
||||
},
|
||||
{
|
||||
"id": "ec623d96-5b17-4a67-8206-d475a76b2f31",
|
||||
"color": "orange",
|
||||
|
||||
+1
-2
@@ -35,8 +35,7 @@ export class ResetCalendarChannelService {
|
||||
connectedAccountId,
|
||||
},
|
||||
{
|
||||
syncStage:
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStatus: null,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ export class ResetMessageChannelService {
|
||||
connectedAccountId,
|
||||
},
|
||||
{
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
|
||||
handle: 'tim@apple.dev',
|
||||
isSyncEnabled: true,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: MESSAGE_CHANNEL_DATA_SEED_IDS.JONY,
|
||||
@@ -72,7 +72,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
|
||||
handle: 'jony.ive@apple.dev',
|
||||
isSyncEnabled: true,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: MESSAGE_CHANNEL_DATA_SEED_IDS.PHIL,
|
||||
@@ -85,7 +85,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
|
||||
handle: 'phil.schiler@apple.dev',
|
||||
isSyncEnabled: true,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: MESSAGE_CHANNEL_DATA_SEED_IDS.SUPPORT,
|
||||
@@ -98,7 +98,7 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
|
||||
handle: 'support@apple.dev',
|
||||
isSyncEnabled: true,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
{
|
||||
id: MESSAGE_CHANNEL_DATA_SEED_IDS.SALES,
|
||||
@@ -111,6 +111,6 @@ export const MESSAGE_CHANNEL_DATA_SEEDS: MessageChannelDataSeed[] = [
|
||||
handle: 'sales@apple.dev',
|
||||
isSyncEnabled: true,
|
||||
visibility: MessageChannelVisibility.SHARE_EVERYTHING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
},
|
||||
];
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ export class BlocklistReimportCalendarEventsJob {
|
||||
accountOwnerId: workspaceMemberId,
|
||||
},
|
||||
syncStage: Not(
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ export class CalendarRelaunchFailedCalendarChannelsCommand extends ActiveOrSuspe
|
||||
failedCalendarChannels.map(({ id }) => id),
|
||||
{
|
||||
syncStage:
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStatus: CalendarChannelSyncStatus.ACTIVE,
|
||||
},
|
||||
);
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ export class CalendarEventListFetchCronJob {
|
||||
const schemaName = getWorkspaceSchemaName(activeWorkspace.id);
|
||||
|
||||
const calendarChannels = await this.coreDataSource.query(
|
||||
`SELECT * FROM ${schemaName}."calendarChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING}', '${CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING}')`,
|
||||
`SELECT * FROM ${schemaName}."calendarChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING}')`,
|
||||
);
|
||||
|
||||
for (const calendarChannel of calendarChannels) {
|
||||
|
||||
+1
-2
@@ -58,8 +58,7 @@ export class CalendarEventListFetchJob {
|
||||
|
||||
switch (calendarChannel.syncStage) {
|
||||
case CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_SCHEDULED:
|
||||
case CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING: // DEPRECATED
|
||||
case CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING: // WILL BE DEPRECATED
|
||||
case CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING:
|
||||
await this.calendarFetchEventsService.fetchCalendarEvents(
|
||||
calendarChannel,
|
||||
calendarChannel.connectedAccount,
|
||||
|
||||
+3
-12
@@ -18,8 +18,7 @@ import {
|
||||
import { CalendarChannelSyncStatusService } from 'src/modules/calendar/common/services/calendar-channel-sync-status.service';
|
||||
import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
export enum CalendarEventImportSyncStep {
|
||||
FULL_CALENDAR_EVENT_LIST_FETCH = 'FULL_CALENDAR_EVENT_LIST_FETCH',
|
||||
PARTIAL_CALENDAR_EVENT_LIST_FETCH = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH',
|
||||
CALENDAR_EVENT_LIST_FETCH = 'CALENDAR_EVENT_LIST_FETCH',
|
||||
CALENDAR_EVENTS_IMPORT = 'CALENDAR_EVENTS_IMPORT',
|
||||
}
|
||||
|
||||
@@ -129,13 +128,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
);
|
||||
|
||||
switch (syncStep) {
|
||||
case CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH:
|
||||
await this.calendarChannelSyncStatusService.scheduleCalendarEventListFetch(
|
||||
[calendarChannel.id],
|
||||
);
|
||||
break;
|
||||
|
||||
case CalendarEventImportSyncStep.PARTIAL_CALENDAR_EVENT_LIST_FETCH:
|
||||
case CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH:
|
||||
await this.calendarChannelSyncStatusService.scheduleCalendarEventListFetch(
|
||||
[calendarChannel.id],
|
||||
);
|
||||
@@ -199,9 +192,7 @@ export class CalendarEventImportErrorHandlerService {
|
||||
calendarChannel: Pick<CalendarChannelWorkspaceEntity, 'id'>,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
if (
|
||||
syncStep === CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH
|
||||
) {
|
||||
if (syncStep === CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+2
-11
@@ -16,10 +16,7 @@ import {
|
||||
import { CalendarEventsImportService } from 'src/modules/calendar/calendar-event-import-manager/services/calendar-events-import.service';
|
||||
import { CalendarGetCalendarEventsService } from 'src/modules/calendar/calendar-event-import-manager/services/calendar-get-events.service';
|
||||
import { CalendarChannelSyncStatusService } from 'src/modules/calendar/common/services/calendar-channel-sync-status.service';
|
||||
import {
|
||||
CalendarChannelSyncStage,
|
||||
type CalendarChannelWorkspaceEntity,
|
||||
} from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { type CalendarChannelWorkspaceEntity } from 'src/modules/calendar/common/standard-objects/calendar-channel.workspace-entity';
|
||||
import { type ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
|
||||
@Injectable()
|
||||
@@ -41,12 +38,6 @@ export class CalendarFetchEventsService {
|
||||
connectedAccount: ConnectedAccountWorkspaceEntity,
|
||||
workspaceId: string,
|
||||
): Promise<void> {
|
||||
const syncStep =
|
||||
calendarChannel.syncStage ===
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING
|
||||
? CalendarEventImportSyncStep.FULL_CALENDAR_EVENT_LIST_FETCH
|
||||
: CalendarEventImportSyncStep.PARTIAL_CALENDAR_EVENT_LIST_FETCH;
|
||||
|
||||
await this.calendarChannelSyncStatusService.markAsCalendarEventListFetchOngoing(
|
||||
[calendarChannel.id],
|
||||
);
|
||||
@@ -142,7 +133,7 @@ export class CalendarFetchEventsService {
|
||||
this.logger.error(error);
|
||||
await this.calendarEventImportErrorHandlerService.handleDriverException(
|
||||
error,
|
||||
syncStep,
|
||||
CalendarEventImportSyncStep.CALENDAR_EVENT_LIST_FETCH,
|
||||
calendarChannel,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
+2
-4
@@ -38,8 +38,7 @@ export class CalendarChannelSyncStatusService {
|
||||
);
|
||||
|
||||
await calendarChannelRepository.update(calendarChannelIds, {
|
||||
syncStage:
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,8 +148,7 @@ export class CalendarChannelSyncStatusService {
|
||||
);
|
||||
|
||||
await calendarChannelRepository.update(calendarChannelIds, {
|
||||
syncStage:
|
||||
CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStatus: CalendarChannelSyncStatus.ACTIVE,
|
||||
throttleFailureCount: 0,
|
||||
syncStageStartedAt: null,
|
||||
|
||||
-15
@@ -36,8 +36,6 @@ export enum CalendarChannelSyncStatus {
|
||||
|
||||
export enum CalendarChannelSyncStage {
|
||||
PENDING_CONFIGURATION = 'PENDING_CONFIGURATION',
|
||||
FULL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'FULL_CALENDAR_EVENT_LIST_FETCH_PENDING', // WILL BE DEPRECATED
|
||||
PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING = 'PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING', // DEPRECATED
|
||||
CALENDAR_EVENT_LIST_FETCH_PENDING = 'CALENDAR_EVENT_LIST_FETCH_PENDING',
|
||||
CALENDAR_EVENT_LIST_FETCH_SCHEDULED = 'CALENDAR_EVENT_LIST_FETCH_SCHEDULED',
|
||||
CALENDAR_EVENT_LIST_FETCH_ONGOING = 'CALENDAR_EVENT_LIST_FETCH_ONGOING',
|
||||
@@ -182,19 +180,6 @@ export class CalendarChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
position: 6,
|
||||
color: 'red',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
label: 'Full calendar event list fetch pending',
|
||||
position: 7,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value:
|
||||
CalendarChannelSyncStage.PARTIAL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
label: 'Partial calendar event list fetch pending',
|
||||
position: 8,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: CalendarChannelSyncStage.PENDING_CONFIGURATION,
|
||||
label: 'Pending configuration',
|
||||
|
||||
+5
-5
@@ -124,7 +124,7 @@ describe('ImapSmtpCalDavAPIService', () => {
|
||||
handle: 'test@example.com',
|
||||
isSyncEnabled: true,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
};
|
||||
@@ -154,7 +154,7 @@ describe('ImapSmtpCalDavAPIService', () => {
|
||||
handle: 'test@example.com',
|
||||
isSyncEnabled: true,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
},
|
||||
@@ -254,7 +254,7 @@ describe('ImapSmtpCalDavAPIService', () => {
|
||||
handle: 'test@example.com',
|
||||
isSyncEnabled: true,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
};
|
||||
|
||||
mockMessageChannelRepository.save.mockResolvedValue(
|
||||
@@ -363,7 +363,7 @@ describe('ImapSmtpCalDavAPIService', () => {
|
||||
handle: 'test@example.com',
|
||||
isSyncEnabled: true,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
};
|
||||
|
||||
mockMessageChannelRepository.save.mockResolvedValue(
|
||||
@@ -422,7 +422,7 @@ describe('ImapSmtpCalDavAPIService', () => {
|
||||
handle: 'test@example.com',
|
||||
isSyncEnabled: true,
|
||||
syncStatus: MessageChannelSyncStatus.ONGOING,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
};
|
||||
|
||||
const expectedCalendarChannel = {
|
||||
|
||||
+2
-3
@@ -172,7 +172,7 @@ export class ImapSmtpCalDavAPIService {
|
||||
? MessageChannelSyncStatus.ONGOING
|
||||
: MessageChannelSyncStatus.NOT_SYNCED,
|
||||
syncStage: shouldEnableSync
|
||||
? MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING
|
||||
? MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING
|
||||
: undefined,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
@@ -202,8 +202,7 @@ export class ImapSmtpCalDavAPIService {
|
||||
handle: input.handle,
|
||||
isSyncEnabled: shouldEnableSync,
|
||||
syncStatus: CalendarChannelSyncStatus.ONGOING,
|
||||
syncStage:
|
||||
CalendarChannelSyncStage.FULL_CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncStage: CalendarChannelSyncStage.CALENDAR_EVENT_LIST_FETCH_PENDING,
|
||||
syncCursor: '',
|
||||
syncStageStartedAt: null,
|
||||
},
|
||||
|
||||
+1
-3
@@ -48,9 +48,7 @@ export class BlocklistReimportMessagesJob {
|
||||
connectedAccount: {
|
||||
accountOwnerId: workspaceMemberId,
|
||||
},
|
||||
syncStage: Not(
|
||||
MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
),
|
||||
syncStage: Not(MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ export class MessageChannelSyncStatusService {
|
||||
);
|
||||
|
||||
await messageChannelRepository.update(messageChannelIds, {
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ export class MessageChannelSyncStatusService {
|
||||
|
||||
await messageChannelRepository.update(messageChannelIds, {
|
||||
syncStatus: MessageChannelSyncStatus.ACTIVE,
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
throttleFailureCount: 0,
|
||||
syncStageStartedAt: null,
|
||||
syncedAt: new Date().toISOString(),
|
||||
|
||||
+1
-15
@@ -32,8 +32,6 @@ export enum MessageChannelSyncStatus {
|
||||
|
||||
export enum MessageChannelSyncStage {
|
||||
PENDING_CONFIGURATION = 'PENDING_CONFIGURATION',
|
||||
FULL_MESSAGE_LIST_FETCH_PENDING = 'FULL_MESSAGE_LIST_FETCH_PENDING', // WILL BE DEPRECATED
|
||||
PARTIAL_MESSAGE_LIST_FETCH_PENDING = 'PARTIAL_MESSAGE_LIST_FETCH_PENDING', // DEPRECATED
|
||||
MESSAGE_LIST_FETCH_PENDING = 'MESSAGE_LIST_FETCH_PENDING',
|
||||
MESSAGE_LIST_FETCH_SCHEDULED = 'MESSAGE_LIST_FETCH_SCHEDULED',
|
||||
MESSAGE_LIST_FETCH_ONGOING = 'MESSAGE_LIST_FETCH_ONGOING',
|
||||
@@ -419,22 +417,10 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
position: 6,
|
||||
color: 'red',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING, // WILL BE DEPRECATED
|
||||
label: 'Full messages list fetch pending',
|
||||
position: 7,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING, // DEPRECATED
|
||||
label: 'Partial messages list fetch pending',
|
||||
position: 8,
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
value: MessageChannelSyncStage.PENDING_CONFIGURATION,
|
||||
label: 'Pending configuration',
|
||||
position: 9,
|
||||
position: 7,
|
||||
color: 'gray',
|
||||
},
|
||||
],
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ export class MessagingRelaunchFailedMessageChannelsCommand extends ActiveOrSuspe
|
||||
await messageChannelRepository.update(
|
||||
failedMessageChannels.map(({ id }) => id),
|
||||
{
|
||||
syncStage: MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStage: MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING,
|
||||
syncStatus: MessageChannelSyncStatus.ACTIVE,
|
||||
},
|
||||
);
|
||||
|
||||
+1
-2
@@ -48,9 +48,8 @@ export class MessagingMessageListFetchCronJob {
|
||||
try {
|
||||
const schemaName = getWorkspaceSchemaName(activeWorkspace.id);
|
||||
|
||||
// TODO: deprecate looking for FULL_MESSAGE_LIST_FETCH_PENDING as we introduce MESSAGE_LIST_FETCH_PENDING
|
||||
const messageChannels = await this.coreDataSource.query(
|
||||
`SELECT * FROM ${schemaName}."messageChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING}', '${MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING}')`,
|
||||
`SELECT * FROM ${schemaName}."messageChannel" WHERE "isSyncEnabled" = true AND "syncStage" IN ('${MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING}')`,
|
||||
);
|
||||
|
||||
for (const messageChannel of messageChannels) {
|
||||
|
||||
+2
-4
@@ -77,10 +77,8 @@ export class MessagingMessageListFetchJob {
|
||||
|
||||
switch (messageChannel.syncStage) {
|
||||
case MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING:
|
||||
case MessageChannelSyncStage.PARTIAL_MESSAGE_LIST_FETCH_PENDING: // DEPRECATED
|
||||
case MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING: // WILL BE DEPRECATED
|
||||
await this.messagingMonitoringService.track({
|
||||
eventName: 'full_message_list_fetch.started',
|
||||
eventName: 'message_list_fetch.started',
|
||||
workspaceId,
|
||||
connectedAccountId: messageChannel.connectedAccount.id,
|
||||
messageChannelId: messageChannel.id,
|
||||
@@ -92,7 +90,7 @@ export class MessagingMessageListFetchJob {
|
||||
);
|
||||
|
||||
await this.messagingMonitoringService.track({
|
||||
eventName: 'full_message_list_fetch.completed',
|
||||
eventName: 'message_list_fetch.completed',
|
||||
workspaceId,
|
||||
connectedAccountId: messageChannel.connectedAccount.id,
|
||||
messageChannelId: messageChannel.id,
|
||||
|
||||
+1
-1
@@ -194,7 +194,7 @@ describe('MessagingMessagesImportService', () => {
|
||||
|
||||
it('should fails if SyncStage is not MESSAGES_IMPORT_PENDING', async () => {
|
||||
mockMessageChannel.syncStage =
|
||||
MessageChannelSyncStage.FULL_MESSAGE_LIST_FETCH_PENDING;
|
||||
MessageChannelSyncStage.MESSAGE_LIST_FETCH_PENDING;
|
||||
|
||||
expect(
|
||||
service.processMessageBatchImport(
|
||||
|
||||
Reference in New Issue
Block a user