diff --git a/packages/pockethost/src/cli/commands/EdgeCommand/DaemonCommand/ServeCommand/daemon.ts b/packages/pockethost/src/cli/commands/EdgeCommand/DaemonCommand/ServeCommand/daemon.ts index c72e1357..3813e1ef 100644 --- a/packages/pockethost/src/cli/commands/EdgeCommand/DaemonCommand/ServeCommand/daemon.ts +++ b/packages/pockethost/src/cli/commands/EdgeCommand/DaemonCommand/ServeCommand/daemon.ts @@ -25,6 +25,7 @@ export async function daemon() { // Stop all running containers info(`Stopping all running Docker containers`) const containers = await docker.listContainers({ all: true }) + info(`Found ${containers.length} containers`) await Promise.all( containers.map(async (container) => { if ( @@ -32,6 +33,7 @@ export async function daemon() { container.Image === DOCKER_INSTANCE_IMAGE_NAME ) { try { + info(`Stopping ${container.Id}`) await docker.getContainer(container.Id).stop() info(`Stopped ${container.Id}`) } catch (e) { diff --git a/packages/pockethost/src/services/InstanceService/index.ts b/packages/pockethost/src/services/InstanceService/index.ts index 85d253aa..2d6ec15e 100644 --- a/packages/pockethost/src/services/InstanceService/index.ts +++ b/packages/pockethost/src/services/InstanceService/index.ts @@ -362,12 +362,16 @@ export const instanceService = mkSingleton( throw new Error(`Log in at ${APP_URL()} to verify your account.`) } + const start = now() const api = await (instanceApis[instance.id] = instanceApis[instance.id] || createInstanceApi(instance)).catch((e) => { throw new Error( `Could not launch container. Please review your instance logs at https://app.pockethost.io/app/instances/${instance.id} or contact support at https://pockethost.io/support. [${res.locals.requestId}]`, ) }) + const end = now() + const duration = end - start + console.log(`Container ${instance.id} launch took ${duration}ms`) const endRequest = api.startRequest() res.on('close', endRequest)