Skip to content

#1389 Paused subscriptions with a resumeAt are never automatically resumed - #1412

Open
Olamidepy wants to merge 3 commits into
rinafcode:mainfrom
Olamidepy:fix/1389-auto-resume-paused-subscriptions
Open

#1389 Paused subscriptions with a resumeAt are never automatically resumed#1412
Olamidepy wants to merge 3 commits into
rinafcode:mainfrom
Olamidepy:fix/1389-auto-resume-paused-subscriptions

Conversation

@Olamidepy

Copy link
Copy Markdown
Contributor

Added validation to reject past or invalid resumeAt dates with BadRequestException('resumeAt must be a future date').
When a future resumeAt is provided, calculates delay = resumeDate.getTime() - Date.now() and enqueues a delayed JOB_NAMES.RESUME_SUBSCRIPTION job in Bull queue with retry (attempts: 3, exponential backoff) and auto-removal on complete.
When resumeAt is omitted, the subscription pauses indefinitely without scheduling a queue job.
Idempotent Job Processing in

SubscriptionJobProcessor
:

Implemented @process(JOB_NAMES.RESUME_SUBSCRIPTION) handleResumeSubscription.
Safely handles missing subscriptions and cancelled subscriptions as clean no-ops.
Guards against double-resumption by returning early if isPaused is false.
Transitions paused subscriptions back to ACTIVE via SubscriptionsService.resumeSubscription().
Module Registration in

PaymentsModule
:

Registered QUEUE_NAMES.SUBSCRIPTIONS with BullModule.registerQueue.
Registered SubscriptionsService, SubscriptionsController, and SubscriptionJobProcessor.
Automated Unit Tests:

closes #1389

subscriptions.service.spec.ts
(7 tests covering past date rejection, pause with/without resumeAt, queue scheduling, and resume handling).

subscription-job.processor.spec.ts
(7 tests covering auto-resume execution, idempotency, cancelled/missing subscription safety, and Bull retry propagation).
All 14 tests pass and pnpm build compiles cleanly with 0 errors.

@drips-wave

drips-wave Bot commented Sep 2, 2026

Copy link
Copy Markdown

@Olamidepy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Olamidepy

Copy link
Copy Markdown
Contributor Author

Pls merge....... . @RUKAYAT-CODER

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.

Paused subscriptions with a resumeAt are never automatically resumed

1 participant