Skip to content

Conversation

@vas3a
Copy link
Collaborator

@vas3a vas3a commented Dec 10, 2025

Pgboss's workers don't seem to be fit with webhook actions & multiple tasks (issue with resolving promises when a webhook lands on a different task than it started on). So I switched to using manual fetching of jobs. This gives us more control, and calling job.fail or job.complete actually works (with workers it needed to fulfill the promise first).

@vas3a vas3a requested review from jmgasper and kkartunov December 10, 2025 11:12
import * as PgBoss from 'pg-boss';
import { policies, Queue } from 'pg-boss';

const PGBOSS_JOB_POLLING_INTERVAL = parseInt(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[⚠️ correctness]
Consider validating the environment variable PGBOSS_JOB_POLLING_INTERVAL to ensure it is a positive integer. If the value is invalid, it could lead to unexpected behavior or errors.

import * as PgBoss from 'pg-boss';
import { policies, Queue } from 'pg-boss';

const PGBOSS_JOB_POLLING_INTERVAL_SEC = parseFloat(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[💡 performance]
Consider using Number instead of parseFloat for converting environment variables to numbers. Number is generally more performant and sufficient for this use case, as it handles both integer and floating-point conversions.

@vas3a vas3a merged commit 5fdbf5f into develop Dec 11, 2025
6 checks passed
@vas3a vas3a deleted the PM-3200_switch-away-pgboss-from-worker branch December 11, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants