Skip to contents

Worker loop that pops a single task from the queue, executes the function and pushes the results.

Usage

worker_loop_default(fun, constants = NULL, rush)

Arguments

fun

(function)
Function to be executed.

constants

(list)
List of constants passed to fun.

rush

(RushWorker)
Rush worker instance.

Value

NULL

Examples

# This example is not executed since Redis must be installed
# \donttest{
   config_local = redux::redis_config()
   rush = rsh(network_id = "test_network", config = config_local)
#> Error in initialize(...): Can't connect to Redis. Check the configuration.

   fun = function(x1, x2, ...) list(y = x1 + x2)
   rush$start_local_workers(
     fun = fun,
     worker_loop = worker_loop_default)
#> Error: object 'rush' not found

   rush$stop_workers()
#> Error: object 'rush' not found
# }