3 ms·
Nice clear introduction. You can write a simple Async DB system without running into deadlocks. Deadlocks tend to occur when you have 2 processes trying to loc
by aidos 14y ago
Nice clear introduction.
You can write a simple Async DB system without running into deadlocks. Deadlocks tend to occur when you have 2 processes trying to lock 2 different resources in differing orders. Not a case you'll run into here.
Also, you could do something like (correct me if I'm wrong, but I think it should be safe):
update queue set owner = '1_time_use_rand_key' where owner is null order by id limit 1;
Not that I'm advocating this, you should definitely use a proper system to manage these types of tasks! :)