redisWorker: Initialize a doRedis worker process.

Description Usage Arguments Value Note See Also

View source: R/redisWorker.R


The redisWorker function enrolls the current R session in one or more doRedis worker pools specified by the work queue names. The worker loop takes over the R session until the work queue(s) are deleted, after which the worker loop exits after the linger period, or until the worker has processed iter tasks. Running workers also terminate after network activity with Redis remains inactive for longer than the timeout period set in the redisConnect function. That value defaults internally to 30 seconds in redisWorker. You can increase it by including a timeout=n argument value.


redisWorker(queue, host = "localhost", port = 6379, iter = Inf,
  linger = 30, log = stderr(), connected = FALSE, password = NULL,
  loglevel = 0, timelimit = 0, ...)



work queue name or a vector of queue names


Redis database host name or IP address


Redis database port number


maximum number of tasks to process before exiting the worker loop


timeout in seconds after which the work queue is deleted that the worker terminates


print messages to the specified file connection


set to TRUE to reuse an existing open connection to Redis, otherwise establish a new one


optional Redis database password


set to > 0 to increase verbosity in the log


set to > 0 to specify a task time limit in seconds, after which worker processes are killed; beware that setting this value > 0 will terminate any R worker process if their task takes too long.


Optional additional parameters passed to redisConnect


NULL is invisibly returned.


The worker connection to Redis uses a TCP timeout value of 30 seconds by default. That means that the worker will exit after about 30 seconds of inactivity. If you want the worker to remain active for longer periods, set the timeout option to a larger value.

Use the linger option to instruct the worker to linger for up to the indicated number of seconds after the listening work queue has been removed. After at most that interval, the worker will exit after removing the queue.

See Also

registerDoRedis, startLocalWorkers

bwlewis/doRedis documentation built on Nov. 21, 2018, 1:16 p.m.