Create command to set stale message sync back to pending (#7048)

Some message channels are stuck in an ongoing `syncStage` because
`syncStartedAt` was not set correctly at the beginning of the sync.
This command resets message channels with an ongoing `syncStage` and
`syncStartedAt` set to null.
This commit is contained in:
Raphaël Bosi
2024-09-16 15:10:42 +02:00
committed by GitHub
parent 8208a3e976
commit 833832525c
3 changed files with 103 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import { Repository } from 'typeorm';
import { ActiveWorkspacesCommandRunner } from 'src/database/commands/active-workspaces.command';
import { MigrateEmailFieldsToEmailsCommand } from 'src/database/commands/upgrade-version/0-30/0-30-migrate-email-fields-to-emails.command';
import { SetStaleMessageSyncBackToPendingCommand } from 'src/database/commands/upgrade-version/0-30/0-30-set-stale-message-sync-back-to-pending';
import { Workspace } from 'src/engine/core-modules/workspace/workspace.entity';
import { SyncWorkspaceMetadataCommand } from 'src/engine/workspace-manager/workspace-sync-metadata/commands/sync-workspace-metadata.command';
@ -22,6 +23,7 @@ export class UpgradeTo0_30Command extends ActiveWorkspacesCommandRunner {
protected readonly workspaceRepository: Repository<Workspace>,
private readonly syncWorkspaceMetadataCommand: SyncWorkspaceMetadataCommand,
private readonly migrateEmailFieldsToEmails: MigrateEmailFieldsToEmailsCommand,
private readonly setStaleMessageSyncBackToPendingCommand: SetStaleMessageSyncBackToPendingCommand,
) {
super(workspaceRepository);
}
@ -44,5 +46,10 @@ export class UpgradeTo0_30Command extends ActiveWorkspacesCommandRunner {
options,
workspaceIds,
);
await this.setStaleMessageSyncBackToPendingCommand.executeActiveWorkspacesCommand(
passedParam,
options,
workspaceIds,
);
}
}