You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 26, 2026. It is now read-only.
Queue consumers, Redis connection ownership, distributed locks, and scheduler implementations currently live inside @upstand/usecases:
DeploymentWorker creates BullMQ workers and Redis connections and owns worker lifecycle.
BackupRunWorker creates its own Redis connection, BullMQ worker, retry handling, lock-renewal timer, and scoped execution.
NotificationDeliveryWorker creates and manages another BullMQ worker and Redis connection.
BackupScheduler, GeneralScheduler, access-log cleanup, queue reconciliation, queue naming, and several lock helpers are also application-package runtime concerns.
@upstand/usecases directly depends on @upstand/redis, bullmq, and croner.
The business capabilities—queue a deployment, trigger a backup, publish a notification, execute a scheduled action—belong in the application layer. BullMQ, Redis clients, cron timers, worker event listeners, process lifecycle, and reconnection behavior are runtime adapters.
Reviewed against master at 7f9e26400a474aa5a706d261f24fa2bf3d98ce8c.
Architectural impact
Application tests and package consumers inherit Redis/BullMQ runtime dependencies.
Queue technology is embedded in use-case modules, making replacement or alternate execution modes expensive.
Worker lifecycle and graceful shutdown are split between the application package and the server host.
Every worker independently configures connection and failure behavior, increasing operational drift.
Business handlers cannot be executed synchronously or by another queue adapter without importing BullMQ-specific classes and job types.
Proposed direction
Define application ports for enqueueing deployment, backup, notification, and scheduled jobs.
Define typed job commands/events in a lightweight application or contracts module without BullMQ types.
Move BullMQ queue creation, Worker construction, Redis connections, worker event listeners, retry/backoff translation, and shutdown into @upstand/redis, @upstand/infrastructure, or a dedicated @upstand/runtime package.
Keep small application handlers such as ProcessDeploymentCommand, ExecuteBackupRunUseCase, and DeliverNotificationUseCase independent of queue transport.
Have the server host compose queue adapters with handlers and own start/readiness/drain/stop lifecycle.
Summary
Queue consumers, Redis connection ownership, distributed locks, and scheduler implementations currently live inside
@upstand/usecases:DeploymentWorkercreates BullMQ workers and Redis connections and owns worker lifecycle.BackupRunWorkercreates its own Redis connection, BullMQ worker, retry handling, lock-renewal timer, and scoped execution.NotificationDeliveryWorkercreates and manages another BullMQ worker and Redis connection.BackupScheduler,GeneralScheduler, access-log cleanup, queue reconciliation, queue naming, and several lock helpers are also application-package runtime concerns.@upstand/usecasesdirectly depends on@upstand/redis,bullmq, andcroner.The business capabilities—queue a deployment, trigger a backup, publish a notification, execute a scheduled action—belong in the application layer. BullMQ, Redis clients, cron timers, worker event listeners, process lifecycle, and reconnection behavior are runtime adapters.
Reviewed against
masterat7f9e26400a474aa5a706d261f24fa2bf3d98ce8c.Architectural impact
Proposed direction
Workerconstruction, Redis connections, worker event listeners, retry/backoff translation, and shutdown into@upstand/redis,@upstand/infrastructure, or a dedicated@upstand/runtimepackage.ProcessDeploymentCommand,ExecuteBackupRunUseCase, andDeliverNotificationUseCaseindependent of queue transport.Incremental migration
bullmq,croner, and@upstand/redisfrom@upstand/usecasesdependencies.Acceptance criteria
Queue,Worker,Job, orDelayedErrortypes appear in application-layer source.@upstand/usecaseshas no production dependency on BullMQ, Croner, or the concrete Redis package.Suggested tests