Hacker News new | ask | show | jobs
by aidos 4969 days 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! :)