chore(pockethost): remove upgrade mode and maintenance mode throw

This commit is contained in:
Ben Allfree 2024-07-31 13:50:27 +00:00
parent ad4a6ff8bf
commit 9429e52cad
2 changed files with 0 additions and 24 deletions

View File

@ -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

View File

@ -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)
})