From 9429e52cad580c38d31ed9b67336ce7552c6a82a Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Wed, 31 Jul 2024 13:50:27 +0000 Subject: [PATCH] chore(pockethost): remove upgrade mode and maintenance mode throw --- packages/pockethost/src/constants.ts | 2 -- .../src/services/InstanceService/index.ts | 22 ------------------- 2 files changed, 24 deletions(-) diff --git a/packages/pockethost/src/constants.ts b/packages/pockethost/src/constants.ts index c85bd86b..93f23b10 100644 --- a/packages/pockethost/src/constants.ts +++ b/packages/pockethost/src/constants.ts @@ -81,7 +81,6 @@ if (_IS_DEV) { export const SETTINGS = { PH_PLUGINS: mkCsvString([`@pockethost/plugin-console-logger`]), - UPGRADE_MODE: mkBoolean(false), PH_HOME: mkPath(_PH_HOME, { create: true }), PH_PROJECT_ROOT: mkPath(_PH_PROJECT_ROOT), @@ -200,7 +199,6 @@ export const instanceLogger = () => ioc.service('instanceLogger') /** Accessors */ export const PH_PLUGINS = () => settings().PH_PLUGINS -export const UPGRADE_MODE = () => settings().UPGRADE_MODE export const PH_HOME = () => settings().PH_HOME export const PH_PROJECT_ROOT = () => settings().PH_PROJECT_ROOT diff --git a/packages/pockethost/src/services/InstanceService/index.ts b/packages/pockethost/src/services/InstanceService/index.ts index 7c12a062..49c72db8 100644 --- a/packages/pockethost/src/services/InstanceService/index.ts +++ b/packages/pockethost/src/services/InstanceService/index.ts @@ -17,7 +17,6 @@ import { InstanceStatus, LoggerService, SingletonBaseConfig, - UPGRADE_MODE, asyncExitHook, createCleanupManager, createTimerManager, @@ -327,18 +326,10 @@ export const instanceService = mkSingleton( const childProcess = await (async () => { try { const cp = await pbService.spawn(spawnArgs) - return cp } catch (e) { warn(`Error spawning: ${e}`) userInstanceLogger.error(`Error spawning: ${e}`) - if (UPGRADE_MODE()) { - // Noop - } else { - updateInstance(instance.id, { - maintenance: true, - }) - } throw new Error( `Could not launch container. Instance has been placed in maintenance mode. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support`, ) @@ -347,19 +338,6 @@ export const instanceService = mkSingleton( const { exitCode } = childProcess exitCode.then((code) => { info(`Processes exited with ${code}.`) - if (code !== 0 && !UPGRADE_MODE()) { - shutdownManager.add(async () => { - userInstanceLogger.error( - `Putting instance in maintenance mode because it shut down with return code ${code}. `, - ) - error( - `Putting instance in maintenance mode because it shut down with return code ${code}. `, - ) - updateInstance(instance.id, { - maintenance: true, - }) - }) - } setImmediate(() => { _safeShutdown().catch(error) })