Просмотр исходного кода

fix(apps): update all apps in a stuck state to "stopped" upon restart

Nicolas Meienberger 2 лет назад
Родитель
Сommit
48cee9d23d
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      src/server/services/apps/apps.service.ts

+ 3 - 0
src/server/services/apps/apps.service.ts

@@ -37,6 +37,9 @@ export class AppServiceClass {
   public async startAllApps() {
   public async startAllApps() {
     const apps = await this.prisma.app.findMany({ where: { status: 'running' }, orderBy: { id: 'asc' } });
     const apps = await this.prisma.app.findMany({ where: { status: 'running' }, orderBy: { id: 'asc' } });
 
 
+    // Update all apps with status different than running or stopped to stopped
+    await this.prisma.app.updateMany({ where: { status: { notIn: ['running', 'stopped', 'missing'] } }, data: { status: 'stopped' } });
+
     await Promise.all(
     await Promise.all(
       apps.map(async (app) => {
       apps.map(async (app) => {
         // Regenerate env file
         // Regenerate env file