Skip to content

Commit

Permalink
fix: Start cronjobs after the database has been migrated (#34215)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Dec 19, 2024
1 parent 0dc17e9 commit 082d3ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/lucky-wolves-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a UI issue that showed the incorrect migration number on the `Information` page. This was caused by a function calculating the stats before the server had migrated the database and updated the control.
8 changes: 3 additions & 5 deletions apps/meteor/server/startup/cron.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Logger } from '@rocket.chat/logger';
import { Meteor } from 'meteor/meteor';

import { federationCron } from '../cron/federation';
import { npsCron } from '../cron/nps';
Expand All @@ -12,14 +11,13 @@ import { videoConferencesCron } from '../cron/videoConferences';

const logger = new Logger('SyncedCron');

Meteor.defer(async () => {
export const startCronJobs = async (): Promise<void> => {
await startCron();

await oembedCron();
await usageReportCron(logger);
await npsCron();
await temporaryUploadCleanupCron();
await federationCron();
await videoConferencesCron();
await userDataDownloadsCron();
});
userDataDownloadsCron();
};
4 changes: 3 additions & 1 deletion apps/meteor/server/startup/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './appcache';
import './callbacks';
import './cron';
import { startCronJobs } from './cron';
import './initialData';
import './serverRunning';
import './coreApps';
Expand All @@ -13,6 +13,8 @@ import { isRunningMs } from '../lib/isRunningMs';

export const startup = async () => {
await performMigrationProcedure();

setImmediate(() => startCronJobs());
// only starts network broker if running in micro services mode
if (!isRunningMs()) {
require('./localServices');
Expand Down

0 comments on commit 082d3ce

Please sign in to comment.