mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-12 17:16:40 +00:00
dbg: output container launch times
This commit is contained in:
parent
37e94a610c
commit
8f35d0edbd
@ -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) {
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user