Skip to content

feat(worker): Job queue environment cache#9817

Merged
scopsy merged 1 commit intonextfrom
cursor/job-queue-environment-cache-1f63
Jan 9, 2026
Merged

feat(worker): Job queue environment cache#9817
scopsy merged 1 commit intonextfrom
cursor/job-queue-environment-cache-1f63

Conversation

@scopsy
Copy link
Contributor

@scopsy scopsy commented Jan 9, 2026

What changed? Why was the change needed?

Introduced an LRU cache for fetching environment data from MongoDB within the execute-bridge-job use case in the worker. This change reduces database load and improves performance by caching frequently accessed environments, mirroring existing caching patterns for workflows.

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

The cache has a 60-second TTL and a maximum size of 500 items. It is enabled via the IS_LRU_CACHE_ENABLED feature flag, specifically for the worker-environment component. The implementation pattern, including handling inflight requests, is consistent with existing LRU cache usage in the codebase.


Slack Thread

Open in Cursor Open in Web

Improves performance by caching environment data and reducing database calls.

Co-authored-by: dima <dima@novu.co>
@cursor
Copy link
Contributor

cursor bot commented Jan 9, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@netlify
Copy link

netlify bot commented Jan 9, 2026

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit e4dc123
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/6961113024ec0f00087ccafc

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: feat(worker): Job queue environment cache

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

@scopsy scopsy changed the title Job queue environment cache feat(worker): Job queue environment cache Jan 9, 2026
@scopsy scopsy marked this pull request as ready for review January 9, 2026 14:41
@scopsy scopsy merged commit 5ee07d6 into next Jan 9, 2026
28 of 30 checks passed
@scopsy scopsy deleted the cursor/job-queue-environment-cache-1f63 branch January 9, 2026 14:41
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This change introduces a feature flag-driven caching mechanism for environment data retrieval in the ExecuteBridgeJob usecase. An LRU cache and in-flight request tracking were added to store and reuse environment lookup results, preventing duplicate fetches. A new private getEnvironment() method was created to conditionally apply caching when the corresponding feature flag is enabled. The method integrates with FeatureFlagsService and EnvironmentRepository, with environment retrieval in execute-paths updated to use this new caching layer.


📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 257f1f4 and e4dc123.

📒 Files selected for processing (1)
  • apps/worker/src/app/workflow/usecases/execute-bridge-job/execute-bridge-job.usecase.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants