R Under development (unstable) (2025-09-02 r88773 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(doRedis) Loading required package: doRedis Loading required package: foreach Loading required package: iterators > > compare <- function(x, y, label="unexpected result") + { + if(!isTRUE(all.equal(x, y))) stop(label) + } > > if(Sys.getenv("TEST_DOREDIS") == "TRUE") + { + setProgress(TRUE) + setFtinterval(10) + # Basic test with two local worker processes + queue <- "jobs" + redisConnect() # need to connect to Redis before removing a queue + removeQueue(queue) + startLocalWorkers(n=2, queue, timeout=1) + registerDoRedis(queue) + ans <- foreach(j=1:10, .combine=sum) %dopar% j + compare(ans, 55, "foreach") + + # setX tests + x <- 0 + setExport("x") + setChunkSize(5) + ans <- foreach(j=1:10, .combine=sum, .noexport="x") %dopar% { + j + x + } + compare(ans, 55, "foreach") + + getDoParWorkers() + + # Shut down + removeQueue(queue) + Sys.sleep(2) # Allow time for workers to terminate + } > > proc.time() user system elapsed 0.21 0.10 0.31