{"action":"created","issue":{"url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/818","repository_url":"https://api.github.com/repos/eventespresso/event-espresso-core","labels_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/818/labels{/name}","comments_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/818/comments","events_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/818/events","html_url":"https://github.com/eventespresso/event-espresso-core/issues/818","id":390422014,"node_id":"MDU6SXNzdWUzOTA0MjIwMTQ=","number":818,"title":"\"Get in line\" to avoid overselling, possibly using middleware, command bus, or helper methods","user":{"login":"mnelson4","id":1766382,"node_id":"MDQ6VXNlcjE3NjYzODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1766382?v=4","gravatar_id":"","url":"https://api.github.com/users/mnelson4","html_url":"https://github.com/mnelson4","followers_url":"https://api.github.com/users/mnelson4/followers","following_url":"https://api.github.com/users/mnelson4/following{/other_user}","gists_url":"https://api.github.com/users/mnelson4/gists{/gist_id}","starred_url":"https://api.github.com/users/mnelson4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnelson4/subscriptions","organizations_url":"https://api.github.com/users/mnelson4/orgs","repos_url":"https://api.github.com/users/mnelson4/repos","events_url":"https://api.github.com/users/mnelson4/events{/privacy}","received_events_url":"https://api.github.com/users/mnelson4/received_events","type":"User","site_admin":false},"labels":[{"id":904091222,"node_id":"MDU6TGFiZWw5MDQwOTEyMjI=","url":"https://api.github.com/repos/eventespresso/event-espresso-core/labels/status:triage","name":"status:triage","color":"f06291","default":false}],"state":"open","locked":false,"assignee":{"login":"sethshoultes","id":235315,"node_id":"MDQ6VXNlcjIzNTMxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/235315?v=4","gravatar_id":"","url":"https://api.github.com/users/sethshoultes","html_url":"https://github.com/sethshoultes","followers_url":"https://api.github.com/users/sethshoultes/followers","following_url":"https://api.github.com/users/sethshoultes/following{/other_user}","gists_url":"https://api.github.com/users/sethshoultes/gists{/gist_id}","starred_url":"https://api.github.com/users/sethshoultes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethshoultes/subscriptions","organizations_url":"https://api.github.com/users/sethshoultes/orgs","repos_url":"https://api.github.com/users/sethshoultes/repos","events_url":"https://api.github.com/users/sethshoultes/events{/privacy}","received_events_url":"https://api.github.com/users/sethshoultes/received_events","type":"User","site_admin":false},"assignees":[{"login":"sethshoultes","id":235315,"node_id":"MDQ6VXNlcjIzNTMxNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/235315?v=4","gravatar_id":"","url":"https://api.github.com/users/sethshoultes","html_url":"https://github.com/sethshoultes","followers_url":"https://api.github.com/users/sethshoultes/followers","following_url":"https://api.github.com/users/sethshoultes/following{/other_user}","gists_url":"https://api.github.com/users/sethshoultes/gists{/gist_id}","starred_url":"https://api.github.com/users/sethshoultes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethshoultes/subscriptions","organizations_url":"https://api.github.com/users/sethshoultes/orgs","repos_url":"https://api.github.com/users/sethshoultes/repos","events_url":"https://api.github.com/users/sethshoultes/events{/privacy}","received_events_url":"https://api.github.com/users/sethshoultes/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2018-12-12T21:45:14Z","updated_at":"2019-02-22T15:35:15Z","closed_at":null,"author_association":"MEMBER","body":"<!--\r\nBEFORE POSTING YOUR ISSUE:\r\n- These comments won't show up when you submit the issue.\r\n- Please ensure that what you are reporting is specific to this project.\r\n- Try to add as much detail as possible. Be specific!\r\n- Make sure you read the README.md for the project regarding posting issues.\r\n- Search this repository for issues and pull requests and whether it has been fixed or reported already.\r\n- Ensure you are using the latest code before reporting bugs (unless you are reporting an issue discovered in a branch).\r\n- Disable all plugins and switch to a default theme to ensure its not a plugin/theme conflict issue.\r\n- To report a security issue, please visit this page: https://eventespresso.com/report-a-security-vulnerability/\r\n-->\r\n\r\n## Issue Overview\r\n<!-- Describe what this issue is about. -->\r\nWe want to avoid overselling at events. On https://github.com/eventespresso/event-espresso-core/issues/306#issuecomment-446440024 I suggeted one way would be to somehow limit so only one request can be in certain critical code blocks at a time, in order to prevent concurrent requests from interfering with each other and resulting in overselling.\r\nOn that ticket, we're going to focus on Brent's original idea which is complementary to the one I suggested.\r\nThere are 3 main possibly approaches to this:\r\n- **middleware** so certain requests aren't allowed to happen concurrently (eg, only one ticket selector or one SPCO finalize step request at a time; this could cause the biggest bottleneck but is kinda elegant in design)\r\n- **command bus** so certain commands aren't allowed to happen concurrently (eg only one \"approve registration\" command at a time; IMO this would be the most elegant design but probably biggest refactor)\r\n- **helper methods** which can be called anywhere. We'd probably call them just before and after doing any code that reads/writes to the tickets and datetimes' reserved and sold counts. (This would probably be the easiest and fastest but least elegant; highest likelihood of forgetting to call these helper methods in spots that would benefit from them.)\r\n\r\nIt would be great if we could come up with a way to test this well. Otherwise we're kinda in the dark about how well we've actually avoided overselling.\r\n\r\n\r\n## Bug report or feature request?\r\n\r\n* [x] Bug\r\n* [ ] Feature\r\n* [ ] Neither\r\n\r\n## Steps to Reproduce (for bugs)\r\n<!-- If possible provide any links to a live example, or an unambiguous set of steps to reproduce this bug -->\r\n<!-- Feel free to include code to reproduce if relevant. -->\r\nIt's hard, especially when I believe most webservers are setup to NOT handle concurrent requests. But basically, have two requests come in simultaneously to reserve a ticket when there's actually only space for 1. \r\n\r\n\r\n## Expected Behaviour\r\n<!-- If you're describing a bug, tell us what should happen -->\r\n<!-- If you're describing a feature/enhancement, explain the difference from current behaviour -->\r\nThe request that arrives a millisecond late should be told the ticket isn't available.\r\n\r\n\r\n## Current Behaviour\r\n<!-- If describing a bug, what is the current behaviour and how does it differ from expected behaviour? -->\r\n<!-- If describing a feature, describe what the current behaviour is in the part of the application that you want your feature suggestion to improve on. -->\r\nThe event will get oversold.\r\n\r\n## Related Information:\r\n<!-- \r\n- If you were directed to create an issue here by the EE support team, you can include the link to your original EE support forum thread.\r\n- You can also include any other links you think may be useful (related issues and/or Pull Requests)\r\n- Any screenshots or screencasts that help illustrate what you are describing is always useful.\r\n-->\r\nThere is a related middleware proposed here: https://github.com/eventespresso/event-espresso-core/issues/344\r\n\r\nBrent suggested they might correlate with this (possible) middleware in the following way:\r\n> I think the two middleware (MW) would work like this:\r\n\r\n>-  Rate Limiting MW would control # of registrations in progress based on value set in admin (let's say 10)\r\n\r\n>- M-Mode MW would activate, but check # of registrations in progress (let's say 3) and then save current value for Rate Limiting MW reg in progress (10), then change that to match current regs in progress (3) so that Rate Limiting MW blocks any new registration requests from starting\r\n\r\n>- then as registrations complete, M-Mode MW decrements the regs in progress allowed (2, then 1) which continually prevents new registrations from starting\r\n\r\n>- eventually M-Mode MW sets that value to 0 and fully activates M-Mode\r\n\r\n>- when M-Mode is complete (db update, whatever) then M-Mode MW resets value of regs in progress allowed back to original value (10)\r\n"},"comment":{"url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/comments/466438283","html_url":"https://github.com/eventespresso/event-espresso-core/issues/818#issuecomment-466438283","issue_url":"https://api.github.com/repos/eventespresso/event-espresso-core/issues/818","id":466438283,"node_id":"MDEyOklzc3VlQ29tbWVudDQ2NjQzODI4Mw==","user":{"login":"nerrad","id":1429108,"node_id":"MDQ6VXNlcjE0MjkxMDg=","avatar_url":"https://avatars1.githubusercontent.com/u/1429108?v=4","gravatar_id":"","url":"https://api.github.com/users/nerrad","html_url":"https://github.com/nerrad","followers_url":"https://api.github.com/users/nerrad/followers","following_url":"https://api.github.com/users/nerrad/following{/other_user}","gists_url":"https://api.github.com/users/nerrad/gists{/gist_id}","starred_url":"https://api.github.com/users/nerrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nerrad/subscriptions","organizations_url":"https://api.github.com/users/nerrad/orgs","repos_url":"https://api.github.com/users/nerrad/repos","events_url":"https://api.github.com/users/nerrad/events{/privacy}","received_events_url":"https://api.github.com/users/nerrad/received_events","type":"User","site_admin":false},"created_at":"2019-02-22T15:35:15Z","updated_at":"2019-02-22T15:35:15Z","author_association":"MEMBER","body":"@tn3rb 's proposal sounds very similar to the concept of a `mutex` and I think it would work well here.  However, I would suggest that this be something that is opt-in for a site as it could degrade the flow for very low traffic sites.  I would envision this being something that is enabled at the event level for event managers who know they have potential for high traffic sell-out conditions for an event.\r\n\r\nOne of the best explanations of the `mutex` term I found here: https://stackoverflow.com/a/34558/439720"}}
{"actor":{"display_login":"nerrad"}}