fix: only run version check in production env (#31443)
This commit is contained in:
@@ -394,6 +394,10 @@ export class ConfigRepository {
|
||||
return this.getEnv().environment === ImmichEnvironment.Development;
|
||||
}
|
||||
|
||||
isProduction() {
|
||||
return this.getEnv().environment === ImmichEnvironment.Production;
|
||||
}
|
||||
|
||||
getWorker() {
|
||||
return this.worker;
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user