Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

it wont work with a timestamp because each write will have an affected row of 1 beacuse the writes happen at different times. setting a boolean is static


You can do something like UPDATE row SET timeout = NOW() WHERE NOW() - taskTimeout > row.timestamp. You're not stuck with comparing bools.


update tasks set taken_timestamp = now() where task_id = ? and taken_timestamp is null


update row set taken=true,taken_by=my_id,taken_at=now() where taken is false;




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: