Skip to content

Commit 45692ec

Browse files
committed
Use queue prefix
1 parent 53ea440 commit 45692ec

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

packages/world-postgres/src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { createFunctionProxy } from './proxies/function-proxy.js';
66
import { createHttpProxy } from './proxies/http-proxy.js';
77
import { createQueue } from './queue.js';
88
import {
9-
createPgBossFunctionProxy,
10-
createPgBossHttpProxy,
9+
createPgBossFunctionProxyQueue,
10+
createPgBossHttpProxyQueue,
1111
} from './queue-drivers/factories.js';
1212
import { createPgBossQueue } from './queue-drivers/pgboss.js';
1313
import {
@@ -55,11 +55,12 @@ function createStorage(drizzle: Drizzle): Storage {
5555
}
5656

5757
function defaultQueueFactory() {
58-
return createPgBossHttpProxy({
58+
return createPgBossHttpProxyQueue({
5959
baseUrl: process.env.WORKFLOW_POSTGRES_BASE_URL,
6060
connectionString: process.env.WORKFLOW_POSTGRES_URL || DEFAULT_PG_URL,
6161
securityToken:
6262
process.env.WORKFLOW_POSTGRES_SECURITY_TOKEN || 'this-is-not-safe',
63+
jobPrefix: process.env.WORKFLOW_POSTGRES_JOB_PREFIX,
6364
queueConcurrency:
6465
parseInt(process.env.WORKFLOW_POSTGRES_WORKER_CONCURRENCY || '10', 10) ||
6566
10,
@@ -71,4 +72,8 @@ export type { PostgresWorldConfig } from './config.js';
7172
export * from './drizzle/schema.js';
7273

7374
export { createFunctionProxy, createHttpProxy };
74-
export { createPgBossQueue, createPgBossFunctionProxy, createPgBossHttpProxy };
75+
export {
76+
createPgBossQueue,
77+
createPgBossFunctionProxyQueue as createPgBossFunctionProxy,
78+
createPgBossHttpProxyQueue as createPgBossHttpProxy,
79+
};

packages/world-postgres/src/queue-drivers/factories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { QueueDriver } from './types.js';
77
* QueueDriver implementation using pg-boss for job management
88
* and direct function calls for execution.
99
*/
10-
export function createPgBossFunctionProxy(opts: {
10+
export function createPgBossFunctionProxyQueue(opts: {
1111
jobPrefix?: string;
1212
securityToken: string;
1313
connectionString: string;
@@ -33,7 +33,7 @@ export function createPgBossFunctionProxy(opts: {
3333
* QueueDriver implementation using pg-boss for job management
3434
* and HTTP for execution.
3535
*/
36-
export function createPgBossHttpProxy(config: {
36+
export function createPgBossHttpProxyQueue(config: {
3737
port?: number;
3838
baseUrl?: string;
3939
jobPrefix?: string;

packages/world-postgres/src/queue-drivers/pgboss.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ export function createPgBossQueue(
1717
let startPromise: Promise<unknown> | null = null;
1818
const boss = new PgBoss(config.connectionString);
1919

20-
const stepQueueName = 'workflow_steps';
21-
const workflowQueueName = 'workflow_flows';
20+
const prefix = config.jobPrefix || 'workflow_';
21+
const stepQueueName = `${prefix}steps`;
22+
const workflowQueueName = `${prefix}flows`;
2223

2324
const ensureStarted = async () => {
2425
if (!startPromise) {

0 commit comments

Comments
 (0)