skip running the schedule service if the database is not loaded (#5810)

This commit is contained in:
Matt Fiddaman
2025-09-29 14:29:17 +01:00
committed by GitHub
parent c712217a7c
commit 1fc922c672
2 changed files with 12 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid';
import { captureBreadcrumb } from '../../platform/exceptions';
import * as connection from '../../platform/server/connection';
import { logger } from '../../platform/server/log';
import { currentDay, dayFromDate, parseDate } from '../../shared/months';
import { q } from '../../shared/query';
import {
@@ -559,8 +560,12 @@ app.events.on('sync', ({ type }) => {
type === 'success' || type === 'error' || type === 'unauthorized';
if (completeEvent && prefs.getPrefs()) {
const { lastScheduleRun } = prefs.getPrefs();
if (!db.getDatabase()) {
logger.info('database is not available, skipping schedule service');
return;
}
const { lastScheduleRun } = prefs.getPrefs();
if (lastScheduleRun !== currentDay()) {
runMutator(() => advanceSchedulesService(type === 'success'));

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---
Skip the schedule service if the database is not loaded