Skip to content

Commit 2c3ad33

Browse files
committed
add more connection options config
1 parent 08f27d8 commit 2c3ad33

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

apps/event-queue/src/config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export const env = createEnv({
2121
.refine((arr) => arr.length > 0, {
2222
message: "KAFKA_BROKERS must be a non-empty list of brokers",
2323
}),
24+
25+
KAFKA_PARTITIONS_CONSUMED_CONCURRENTLY: z
26+
.number()
27+
.default(5)
28+
.transform((val) => parseInt(val.toString())),
29+
2430
GITHUB_BOT_APP_ID: z.string().optional(),
2531
GITHUB_BOT_PRIVATE_KEY: z.string().optional(),
2632
GITHUB_BOT_CLIENT_ID: z.string().optional(),

apps/event-queue/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const start = async () => {
2222
logger.info("Subscribed to ctrlplane-events topic");
2323

2424
await consumer.run({
25+
partitionsConsumedConcurrently: env.KAFKA_PARTITIONS_CONSUMED_CONCURRENTLY,
2526
eachMessage: async ({ topic, partition, message }) => {
2627
logger.info("Received event", {
2728
topic,

packages/db/src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ const { Pool } = pg;
88

99
export const pool = new Pool({
1010
max: env.POSTGRES_MAX_POOL_SIZE,
11+
min: 1,
1112
connectionString: env.POSTGRES_URL,
13+
keepAlive: true,
1214
ssl: false,
15+
application_name: env.POSTGRES_APPLICATION_NAME,
1316
});
1417

1518
export const db = drizzle(pool, { schema });

packages/db/src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export const env = createEnv({
1313
.default("50")
1414
.transform((value) => parseInt(value)),
1515

16+
POSTGRES_APPLICATION_NAME: z.string().default("ctrlplane"),
17+
1618
REDIS_URL: z.string().url().default("redis://127.0.0.1:6379"),
1719
},
1820
runtimeEnv: process.env,

0 commit comments

Comments
 (0)