Skip to content

feat: Unique wallet transaction job for threshold top-ups #3710

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

Merged
merged 7 commits into from
May 26, 2025

Conversation

brunomiguelpinto
Copy link
Contributor

@brunomiguelpinto brunomiguelpinto commented May 23, 2025

Context

Threshold-based wallet top-ups can sometimes enqueue duplicate jobs if the job is triggered multiple times within a short time window. This leads to unnecessary or duplicate credit grants.

To prevent this, we want to ensure that these jobs are uniquely enqueued based on relevant identifiers: organization_id, wallet_id, paid_credits, and granted_credits.

Description

This PR adds job uniqueness handling to WalletTransactions::CreateJob using sidekiq-unique-jobs, but only when the unique_transaction flag is set to true.

  • Introduced conditional uniqueness based on unique_transaction
  • Fallback to non-unique behaviour when the flag is not set

This keeps behaviour backward-compatible for other use cases of CreateJob, while enforcing uniqueness where it matters.

@brunomiguelpinto brunomiguelpinto changed the title feat: added job unique params feat: Unique wallet transaction job for threshold top-ups May 23, 2025
@brunomiguelpinto brunomiguelpinto self-assigned this May 23, 2025
@brunomiguelpinto brunomiguelpinto merged commit 7ba40d5 into main May 26, 2025
14 checks passed
@brunomiguelpinto brunomiguelpinto deleted the fix-wallet-unique-job branch May 26, 2025 15:45
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.

3 participants