-
-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(redis): add cleanerQueueName option for workflow management #14579
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: develop
Are you sure you want to change the base?
feat(redis): add cleanerQueueName option for workflow management #14579
Conversation
- Introduced cleanerQueueName parameter to support periodic cleanup of expired workflow executions. - Updated RedisDistributedTransactionStorage to utilize cleanerQueueName. - Adjusted tests to reflect the new default cleaner queue name "medusa-workflows-cleaner". This enhancement improves the flexibility and maintainability of the workflow engine.
|
|
@habualoush is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| this.redisClient = redisConnection | ||
| this.redisWorkerConnection = redisWorkerConnection | ||
| this.cleanerQueueName = "workflows-cleaner" | ||
| this.cleanerQueueName = redisCleanerQueueName ?? "medusa-workflows-cleaner" |
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.
Old cleaner queue orphaned without cleanup migration
Low Severity
Changing the default cleaner queue name from "workflows-cleaner" to "medusa-workflows-cleaner" orphans the old queue in Redis. The old queue has a repeatable job that adds tasks every 30 minutes, but no worker processes them after upgrade. This causes gradual Redis memory growth. The codebase has precedent for migration cleanup at lines 191-193 for a similar scenario, but equivalent cleanup for the old cleaner queue name is missing.
Overview
This PR introduces a configurable
cleanerQueueNameparameter to the Redis Workflow Engine module, replacing the hardcoded"workflows-cleaner"with a flexible, configurable option that defaults to"medusa-workflows-cleaner".Summary
What — Changes Introduced
cleanerQueueNameas a configurable option inRedisWorkflowsOptionscleanerQueueNamethrough dependency injectionRedisDistributedTransactionStorageto use the configurable name with sensible defaultWhy — Motivation
medusa-prefix; cleaner queue now follows same conventionHow — Implementation Details
Files Changed
src/types/index.ts— Added type definition forcleanerQueueNamesrc/loaders/redis.ts— Added loader logic to handle the new parametersrc/utils/workflow-orchestrator-storage.ts— Updated constructor to use configurable namesrc/utils/__tests__/workflow-orchestrator-storage.spec.ts— Updated test expectationsCode Changes
Before:
After:
Testing
How to Test
Manual Verification
medusa-workflows-cleanerCustom Configuration Test
Usage Examples
Default Behavior
Custom Queue Name
Multi-Tenant Setup
Checklist
Notes
cleanerQueueNamewill use the new defaultNote
Introduces a configurable cleaner queue name and propagates it through the Redis workflow engine, aligning naming with other queues and enabling overrides.
cleanerQueueNametoRedisWorkflowsOptionsintypes/index.ts(defaultmedusa-workflows-cleaner)loaders/redis.tsto resolvecleanerQueueNameand registerredisCleanerQueueNamewith per-queue optionsRedisDistributedTransactionStorageto consumeredisCleanerQueueNameinstead of hardcoded"workflows-cleaner"utils/__tests__/workflow-orchestrator-storage.spec.tsto expect the new default name and DI pathWritten by Cursor Bugbot for commit 2adf71c. This will update automatically on new commits. Configure here.