Skip to content

Conversation

carlosmonastyrski
Copy link
Contributor

Description 📣

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

@maidul98
Copy link
Collaborator

maidul98 commented Jul 31, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR migrates secret webhook and replication functionality from Redis-based queues to PostgreSQL-based queues using PgBoss. The migration involves significant architectural changes while maintaining backward compatibility.

Key Changes:

  • Queue Migration: Webhooks and secret replication now use queueService.queuePg() instead of queueService.queue(), with updated configuration options (retryLimit, retryBackoff, retentionHours instead of Redis-specific options)
  • Service Initialization: Added init() methods to secret replication and queue services for PostgreSQL queue setup, with proper initialization calls in the server bootstrap process
  • Type System Improvements: Consolidated TSecretQueueFactory type definition in secret-types.ts and improved type safety with TOrmify<TableName.SecretVersion> for the replication DAL
  • Batch Processing: Implemented batch processing for webhook jobs (batchSize: 5) and single-item processing for replication jobs (batchSize: 1) with proper error isolation using Promise.allSettled()
  • Deduplication Strategy: Replaced jobId with singletonKey for better deduplication semantics in PostgreSQL
  • Dual Queue Support: The secret replication service now supports both Redis and PostgreSQL queues during the transition period by extracting core logic into reusable functions

The changes align with Infisical's broader strategy to consolidate on PostgreSQL as the single source of truth, eliminating Redis dependency for queue management while providing better durability guarantees and ACID compliance for critical operations like webhooks and secret replication.

PR Description Notes:

  • The PR description is incomplete - no actual description, type selection, or test details are provided
  • Missing information about the motivation, context, and testing approach for this significant architectural change

Confidence score: 4/5

  • This is a significant but well-structured migration that maintains backward compatibility during transition
  • The main risk is the initialization order and potential race conditions in service startup
  • Files that need attention: backend/src/server/routes/index.ts (service initialization order), backend/src/services/secret/secret-queue.ts (complex queue migration logic), and backend/src/ee/services/secret-replication/secret-replication-service.ts (dual queue support implementation)

14 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

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.

2 participants