db_try_consume: Try to consume a message from the queue

Description Usage Arguments Details of the implementation

View source: R/db.R

Description

If there is a message that it READY, it returns that. Otherwise it checks for crashed workers.

Usage

1
db_try_consume(db, queue, crashed = TRUE, con = NULL)

Arguments

db

DB file name.

queue

Name of the queue.

Details of the implementation

The database must be locked for the whole operation, including checking on or creating the lock databases.

  1. If there is a READY message, that one is taken.

  2. 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

  1. Updating its row.status to WORKING.

  2. Creating another database that serves as the lock for this message.


r-lib/liteq documentation built on Dec. 18, 2017, 9:12 a.m.