Skip to content
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

Try caching get_remaining_tickets() in APCu to allow tickets to be 'reserved' during checkout, avoiding race condition #1296

Closed
wants to merge 4 commits into from

Conversation

dd32
Copy link
Member

@dd32 dd32 commented Apr 23, 2024

Draft PR due to inability to properly test this right now, and unsure if it's the proper direction forward or worth it.

Ref: https://wordpress.slack.com/archives/C08M59V3P/p1712066063709249

WordCamp Sylhet ran into an issue where WordCamp tickets were oversold, due to a race condition during the checkout process.

The ticket are counted on every pageload, and in the event of a few hundred people attempting to checkout at the same instant, resulted in multiple tickets inserting tickets after the initial do we have available tickets check passed.

This PR attempts to add some caching/locking using APCu to the process.

This appears to work at first glance, but is not entirely complete.

  • failed payments locks a ticket for up-to 10 minutes (possibly a good thing?) (fixable)
  • changing the available tickets number doesn't reflect for the up-to 10 minutes (fixable)
  • Hard to test due to low requests/second sandbox throughput

While writing this PR, I've noticed something that was rather odd.
It appears that some of the order verification is checked after the check for errors, resulting in some of the validation being skipped during checkout, although it seems duplicative.. ba27a3a moved that and I've split it into #1295

@dd32
Copy link
Member Author

dd32 commented Apr 24, 2024

I'm closing this, as I don't think this actually resolved anything. I suspect something like #1297 would be better suited.

@dd32 dd32 closed this Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] CampTix Including addons
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant