fix: only run version check in production env (#31443)

This commit is contained in:
bo0tzz
2026-09-11 10:19:45 -04:00
committed by GitHub
parent f0b12b9bd2
commit 72f1034c58
3 changed files with 9 additions and 0 deletions
@@ -394,6 +394,10 @@ export class ConfigRepository {
return this.getEnv().environment === ImmichEnvironment.Development;
}
isProduction() {
return this.getEnv().environment === ImmichEnvironment.Production;
}
getWorker() {
return this.worker;
}
+4
View File
@@ -98,6 +98,10 @@ export class VersionService extends BaseService {
@OnJob({ name: JobName.VersionCheck, queue: QueueName.BackgroundTask })
async handleVersionCheck(): Promise<JobStatus> {
try {
if (!this.configRepository.isProduction()) {
return JobStatus.Skipped;
}
this.logger.debug('Running version check');
const { newVersionCheck } = await this.getConfig({ withCache: true });
@@ -111,5 +111,6 @@ export const newConfigRepositoryMock = (): Mocked<RepositoryInterface<ConfigRepo
getEnv: vitest.fn().mockReturnValue(mockEnvData({})),
getWorker: vitest.fn().mockReturnValue(ImmichWorker.Api),
isDev: vitest.fn().mockReturnValue(false),
isProduction: vitest.fn().mockReturnValue(true),
};
};