Skip to content

Protect against concurrent duplicated webhooks#285

Closed
waiting-for-dev wants to merge 1 commit into
masterfrom
waiting-for-dev/avoid_duplicated_refunds
Closed

Protect against concurrent duplicated webhooks#285
waiting-for-dev wants to merge 1 commit into
masterfrom
waiting-for-dev/avoid_duplicated_refunds

Conversation

@waiting-for-dev

Copy link
Copy Markdown
Contributor

Summary

By acquiring an update lock on the payment, we can ensure that only one concurrent excecution of the webhook handler will manipulate it. That will avoid duplicated log entries and obscure exceptions.

Closes #188

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

By acquiring an update lock on the payment, we can ensure that only one
concurrent excecution of the webhook handler will manipulate it. That will avoid
duplicated log entries and obscure exceptions.

Closes #188
@codecov

codecov Bot commented Apr 17, 2023

Copy link
Copy Markdown

Codecov Report

Merging #285 (7bd100c) into master (b04dedd) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #285   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          27       27           
  Lines         489      489           
=======================================
  Hits          487      487           
  Misses          2        2           
Impacted Files Coverage Δ
...olidus_stripe/webhook/payment_intent_subscriber.rb 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment thread app/subscribers/solidus_stripe/webhook/payment_intent_subscriber.rb
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/avoid_duplicated_refunds branch April 17, 2023 13:15
@waiting-for-dev

Copy link
Copy Markdown
Contributor Author

Sorry, replaced by #286

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.

Be resilient against duplicated webhook events

2 participants