mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-15 02:26:39 +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
|
// Stop all running containers
|
||||||
info(`Stopping all running Docker containers`)
|
info(`Stopping all running Docker containers`)
|
||||||
const containers = await docker.listContainers({ all: true })
|
const containers = await docker.listContainers({ all: true })
|
||||||
|
info(`Found ${containers.length} containers`)
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
containers.map(async (container) => {
|
containers.map(async (container) => {
|
||||||
if (
|
if (
|
||||||
@ -32,6 +33,7 @@ export async function daemon() {
|
|||||||
container.Image === DOCKER_INSTANCE_IMAGE_NAME
|
container.Image === DOCKER_INSTANCE_IMAGE_NAME
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
|
info(`Stopping ${container.Id}`)
|
||||||
await docker.getContainer(container.Id).stop()
|
await docker.getContainer(container.Id).stop()
|
||||||
info(`Stopped ${container.Id}`)
|
info(`Stopped ${container.Id}`)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -362,12 +362,16 @@ export const instanceService = mkSingleton(
|
|||||||
throw new Error(`Log in at ${APP_URL()} to verify your account.`)
|
throw new Error(`Log in at ${APP_URL()} to verify your account.`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const start = now()
|
||||||
const api = await (instanceApis[instance.id] =
|
const api = await (instanceApis[instance.id] =
|
||||||
instanceApis[instance.id] || createInstanceApi(instance)).catch((e) => {
|
instanceApis[instance.id] || createInstanceApi(instance)).catch((e) => {
|
||||||
throw new Error(
|
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}]`,
|
`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()
|
const endRequest = api.startRequest()
|
||||||
res.on('close', endRequest)
|
res.on('close', endRequest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user