| site | https://dudulski.pl |
| github | https://github.com/jandudulski/ |
| bluesky | https://bsky.app/profile/jan.dudulski.pl |
| goodreads | https://www.goodreads.com/user/show/3111218-jan |
| site | https://dudulski.pl |
| github | https://github.com/jandudulski/ |
| bluesky | https://bsky.app/profile/jan.dudulski.pl |
| goodreads | https://www.goodreads.com/user/show/3111218-jan |
Let's say that I want to register handlers for different commands. A registered command might be a class that should work for any instances of that class or a primitive and should work called by value.
So I cannot simply do `command.fetch(command.class).call(...)`
Anything better than this comes to your mind, folks?
I read https://blog.arkency.com/2015/09/testing-race-conditions/ and was wondering if there is any cleaner way for `wait_for_it` flag and here it comes:
TIL: how to wait with threads execution in #ruby so you can start them at the same time as close as possible? welcome `Thread.stop` and `Thread#run`.
By the way, thank you for the blog post Robert! (not on mastodon yet)
Testing race conditions in your Rails app From time to time, there comes a requirement in your application where you have to guarantee that something can be done at most X number of times. For example, only 15 people can subscribe to a course, only limited number of people can buy this physical or virtual product, only 200 people can go to a concert, etc. How do you test that this limitation actually work? And not only work but that it works under heavy load, when there are multiple customers trying to buy the last item because it is a hot event or the product is offered with a big discount?