Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [20.x, 22.x]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/jobs/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export type VisitJobData = {
};

export const asyncVisitJob = async (job: Job<VisitJobData>) => {
console.log(`job ${job.id} starting`);
const data = job.data;
console.log(job.data);
const runner = new PlaywrightRunner(data, config.DEBUG);

try {
Expand All @@ -37,13 +39,15 @@ export const asyncVisitJob = async (job: Job<VisitJobData>) => {

// 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();
Expand Down
1 change: 1 addition & 0 deletions src/routes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
};
};
Expand Down
4 changes: 2 additions & 2 deletions src/utils/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading