If there is a message that it READY
, it returns that. Otherwise it
checks for crashed workers.
db_try_consume(db, queue, crashed = TRUE, con = NULL)
DB file name.
Name of the queue.
The database must be locked for the whole operation, including checking on or creating the lock databases.
If there is a READY
message, that one is taken.
Otherwise if there are WORKING
messages, then
we check them one by one. This might take a lot of
time, and the DB must be locked for the whole search,
so it is not ideal. But I don't have a better solution
right now.
Taking a message means
Updating its row.status to WORKING
.
Creating another database that serves as the lock for this message.