From 87346cba1afc5e2c8ec501a15d6b6b2df1296d94 Mon Sep 17 00:00:00 2001 From: amhsirak Date: Fri, 28 Nov 2025 15:45:30 +0530 Subject: [PATCH] feat: use pgBossClient --- server/src/routes/record.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/src/routes/record.ts b/server/src/routes/record.ts index 8a589811..6676fdb3 100644 --- a/server/src/routes/record.ts +++ b/server/src/routes/record.ts @@ -17,7 +17,7 @@ import { chromium } from 'playwright-extra'; import stealthPlugin from 'puppeteer-extra-plugin-stealth'; import logger from "../logger"; import { requireSignIn } from '../middlewares/auth'; -import { pgBoss } from '../pgboss-worker'; +import { pgBossClient } from '../storage/pgboss'; export const router = Router(); chromium.use(stealthPlugin()); @@ -36,7 +36,7 @@ async function waitForJobCompletion(jobId: string, queueName: string, timeout = } try { - const job = await pgBoss.getJobById(queueName, jobId); + const job = await pgBossClient.getJobById(queueName, jobId); if (!job) { return reject(new Error(`Job ${jobId} not found`)); @@ -79,9 +79,9 @@ router.get('/start', requireSignIn, async (req: AuthenticatedRequest, res: Respo } try { - await pgBoss.createQueue('initialize-browser-recording'); + await pgBossClient.createQueue('initialize-browser-recording'); - const jobId = await pgBoss.send('initialize-browser-recording', { + const jobId = await pgBossClient.send('initialize-browser-recording', { userId: req.user.id, timestamp: new Date().toISOString() }); @@ -139,9 +139,9 @@ router.get('/stop/:browserId', requireSignIn, async (req: AuthenticatedRequest, } try { - await pgBoss.createQueue('destroy-browser'); + await pgBossClient.createQueue('destroy-browser'); - const jobId = await pgBoss.send('destroy-browser', { + const jobId = await pgBossClient.send('destroy-browser', { browserId: req.params.browserId, userId: req.user.id, timestamp: new Date().toISOString() @@ -233,9 +233,9 @@ router.get('/interpret', requireSignIn, async (req: AuthenticatedRequest, res) = } try { - await pgBoss.createQueue('interpret-workflow'); + await pgBossClient.createQueue('interpret-workflow'); - const jobId = await pgBoss.send('interpret-workflow', { + const jobId = await pgBossClient.send('interpret-workflow', { userId: req.user.id, timestamp: new Date().toISOString() }); @@ -270,9 +270,9 @@ router.get('/interpret/stop', requireSignIn, async (req: AuthenticatedRequest, r } try { - await pgBoss.createQueue('stop-interpretation'); + await pgBossClient.createQueue('stop-interpretation'); - const jobId = await pgBoss.send('stop-interpretation', { + const jobId = await pgBossClient.send('stop-interpretation', { userId: req.user.id, timestamp: new Date().toISOString() });