Fan out dunning customer processing - #6214
Open
lago-claude-ai-agent[bot] wants to merge 4 commits into
Open
Conversation
## Context The hourly dunning job evaluates every eligible customer serially, causing its runtime to grow with the customer population. ## Description Dispatch eligible customers to unique per-customer jobs while preserving the existing evaluation behavior and eligibility scope. Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
Contributor
Author
|
Held: CI is not green on this PR; not reviewed. Re-run CI, then re-review. Checks: https://github.com/getlago/lago-api/pull/6214/checks |
Keep frozen model annotations aligned with the database schema. Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
Contributor
Author
|
Contributor
Author
|
Held: CI is not green on this PR; not reviewed. Re-run CI, then re-review. Checks: https://github.com/getlago/lago-api/pull/6214/checks |
| require "rails_helper" | ||
|
|
||
| RSpec.describe DunningCampaigns::ProcessCustomerJob do | ||
| let(:customer) { build(:customer) } |
Collaborator
There was a problem hiding this comment.
To fix the build, this should be
Suggested change
| let(:customer) { build(:customer) } | |
| let(:customer) { create(:customer) } |
Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
Contributor
Author
|
Contributor
Author
|
Hold: customer eligibility is only checked before enqueueing, so the new asynchronous boundary can mutate an ineligible customer.
|
Signed-off-by: lago-claude-ai-agent[bot] <297187938+lago-claude-ai-agent[bot]@users.noreply.github.com>
Contributor
Author
|
Contributor
Author
|
PASS: The fan-out preserves existing dunning behavior in unique per-customer jobs, and regression coverage verifies delegation plus eligibility changes after dispatch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dispatches eligible dunning customers to unique per-customer jobs instead of evaluating them serially in the hourly bulk job. The dispatcher loads only customer IDs in batches, while each bounded job preserves the existing dunning behavior.