diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4da0ff5..ecba8ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x] + node-version: [20.x, 22.x] steps: - uses: actions/checkout@v3 diff --git a/Dockerfile b/Dockerfile index fbdde15..1d1a94c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ WORKDIR /build COPY . . RUN yarn && yarn build -FROM mcr.microsoft.com/playwright:v1.31.1-focal +FROM mcr.microsoft.com/playwright:v1.53.1-jammy LABEL org.opencontainers.image.source="https://github.com/CTFd/Tourist" RUN apt update && \ diff --git a/package.json b/package.json index 7113a55..666d006 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "cmd:get-issuer-token": "ts-node ./src/cli.ts get-issuer-token", "cmd:get-visit-token": "ts-node ./src/cli.ts get-visit-token", "build": "rm -rf ./out && tsc -p tsconfig.production.json", - "start:docker": "node ./src/index.js | pino-pretty", + "start:docker": "node ./src/index.js", "start:serve": "node ./out/index.js | pino-pretty", "start:build": "yarn build && yarn start:serve", "start:dev": "nodemon ./src/index.ts | pino-pretty", diff --git a/src/jobs/api.ts b/src/jobs/api.ts index 1f4cdeb..ce6b959 100644 --- a/src/jobs/api.ts +++ b/src/jobs/api.ts @@ -22,7 +22,9 @@ export type VisitJobData = { }; export const asyncVisitJob = async (job: Job) => { + console.log(`job ${job.id} starting`); const data = job.data; + console.log(job.data); const runner = new PlaywrightRunner(data, config.DEBUG); try { @@ -37,13 +39,15 @@ export const asyncVisitJob = async (job: Job) => { // change the job status to failed with the error message await job.moveToFailed({ message: e.message }); + console.log(`job ${job.id} failed`); } - + console.log(`job ${job.id} succeeded`); return await runner.finish(); }; export const syncVisitJob = async (data: VisitJobData) => { const runner = new PlaywrightRunner(data, config.DEBUG); + console.log(data); try { await runner.init(); diff --git a/src/routes/api.ts b/src/routes/api.ts index 8b6d74f..feef33f 100644 --- a/src/routes/api.ts +++ b/src/routes/api.ts @@ -168,6 +168,7 @@ const getAsyncJobHandler = (fastify: FastifyInstance) => { } const job = await AsyncVisitQueue.add(data); + console.log(`job ${job.id} scheduled`); return reply.send({ status: "scheduled", id: job.id }); }; }; diff --git a/src/utils/runner.ts b/src/utils/runner.ts index 3083cff..d937096 100644 --- a/src/utils/runner.ts +++ b/src/utils/runner.ts @@ -89,8 +89,8 @@ export class PlaywrightRunner { } this.page = await this.context.newPage(); - this.page.setDefaultNavigationTimeout(4000); - this.page.setDefaultTimeout(2000); + this.page.setDefaultNavigationTimeout(3000); + this.page.setDefaultTimeout(1000); } // exec() iterates over steps, splits actions into pre- and post-open and executes