-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(pg-queue): Migrated secret webhook and replication to postgres #3839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Migrates critical queue operations from Redis to PostgreSQL for secret webhooks and replication, improving persistence and reliability of the secret management system.
- Implements PostgreSQL advisory locks and transaction support in
secret-rotation-v2-service.ts
to handle concurrent operations safely - Introduces new
TSecretQueueFactory
type insecret-types.ts
to improve TypeScript inference and maintain type safety across queue operations - Adds initialization steps in
routes/index.ts
to properly sequence secret replication and queue services during server startup - Enhances secret approval workflow in
secret-approval-request-service.ts
with support for encrypted secret values using KMS - Maintains backwards compatibility through dual queue support while transitioning from Redis to PostgreSQL
13 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile
syncIntegrations: (dto: { | ||
secretPath: string; | ||
projectId: string; | ||
environment: string; | ||
isManual?: boolean; | ||
actorId?: string; | ||
deDupeQueue?: Record<string, boolean>; | ||
}) => Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider extracting syncIntegrations DTO into a separate named type for reusability
queueService.start(QueueName.SecretReplication, async (job) => { | ||
await $secretReplicationQueueTask(job.id as string, job.data); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Potential race condition: Both Redis and Postgres queues are active simultaneously. Need coordination mechanism or migration strategy to prevent duplicate processing.
Description 📣
This is part of persistent queue initiative in which the queue that are critical are moved away from redis to postgres. This PR moves secret replication and webhook to postgres queue.
This PR also corrects the ts infer of secret queue service to make ts infer faster.
Type ✨
Tests 🛠️
# Here's some code block to paste some code snippets