mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 17:24:56 +03:00
feat: start action on boot
This commit is contained in:
@@ -151,6 +151,7 @@ export class MaintenanceModule {
|
||||
);
|
||||
|
||||
await this.maintenanceWorkerService.logSecret();
|
||||
void this.maintenanceWorkerService.runAction(state.action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ export class MaintenanceWorkerController {
|
||||
|
||||
@Post('admin/maintenance')
|
||||
@MaintenanceRoute()
|
||||
async setMaintenanceMode(@Body() dto: SetMaintenanceModeDto): Promise<void> {
|
||||
await this.service.runAction(dto);
|
||||
setMaintenanceMode(@Body() dto: SetMaintenanceModeDto): void {
|
||||
void this.service.setAction(dto);
|
||||
}
|
||||
|
||||
@Get('admin/maintenance/backups/list')
|
||||
|
||||
@@ -185,6 +185,14 @@ export class MaintenanceWorkerService {
|
||||
}
|
||||
}
|
||||
|
||||
async setAction(action: SetMaintenanceModeDto) {
|
||||
this.setStatus({
|
||||
action: action.action,
|
||||
});
|
||||
|
||||
await this.runAction(action);
|
||||
}
|
||||
|
||||
async runAction(action: SetMaintenanceModeDto) {
|
||||
switch (action.action) {
|
||||
case MaintenanceAction.Start:
|
||||
@@ -225,7 +233,7 @@ export class MaintenanceWorkerService {
|
||||
}
|
||||
}
|
||||
|
||||
async endMaintenance(): Promise<void> {
|
||||
private async endMaintenance(): Promise<void> {
|
||||
const state: MaintenanceModeState = { isMaintenanceMode: false as const };
|
||||
await this.systemMetadataRepository.set(SystemMetadataKey.MaintenanceMode, state);
|
||||
|
||||
@@ -253,11 +261,9 @@ export class MaintenanceWorkerService {
|
||||
}),
|
||||
);
|
||||
|
||||
this.setStatus({
|
||||
await this.runAction({
|
||||
action: MaintenanceAction.End,
|
||||
});
|
||||
|
||||
await this.endMaintenance();
|
||||
}
|
||||
|
||||
async listBackups(): Promise<Record<'backups' | 'failedBackups', string[]>> {
|
||||
|
||||
Reference in New Issue
Block a user