Fix number of threads bug for ping.peers()

This commit is contained in:
Rucknium 2024-04-16 00:24:07 +00:00
parent cb5227be7f
commit 0a82cf111c

View file

@ -125,7 +125,9 @@ ping.peers <- function(bitmonero.dir = "~/.bitmonero", output.file = "monero_pee
if (nrow(peers) * ping.count > 5) { if (nrow(peers) * ping.count > 5) {
if (is.null(threads)) { if (is.null(threads)) {
n.workers <- min(c(floor(nrow(peers) * ping.count / 5), parallelly::availableCores()*4)) n.workers <- min(c(floor(nrow(peers) * ping.count / 5), parallelly::availableCores()*4, 100)
} else {
n.workers <- threads
} }
options(parallelly.maxWorkers.localhost = 4) # This means number of CPU cores times 4 options(parallelly.maxWorkers.localhost = 4) # This means number of CPU cores times 4
# Most time in thread is waiting for ping to return, so can have # Most time in thread is waiting for ping to return, so can have