Let say i have 3 ymap : todo, doing, done.
We can have multiple workers that observe todo map , and when something new in todo, each worker can do .
let task = todo.get(first_id)
task.worker=me
task.state=“doing”
todo.delete (first_id)
doing.set(first_id, task)
How to be sure that only one worker take the task with a remote y-websocket server ?
I’ve tried to change the state of task as soon as possible , but all workers take the task as soon at it is available, and before one delete it from todo
And all worker work on the task whereas i would like only one worker. But i’m not able to lock/mark a task as already taken before the other take it too.
I want only one worker work on it and other worker take other task in todo map