tarakc02 / ratelimitr

Rate limiting for R functions
Other
40 stars 0 forks source link

reset() not working for lists of functions #8

Closed tarakc02 closed 7 years ago

tarakc02 commented 7 years ago

Example:

f <- function() "f"
g <- function() "g"

limited <- limit_rate(
    list(
        f = f,
        g = g
    ),  
    rate(n = 1, period = 1)
)

# this works correctly
system.time({
    limited$f(); limited$g() 
})

limited2 <- reset(limited)

# but this finishes in 0 seconds
system.time({
    limited2$f(); limited2$g() 
})

# this still works correctly
system.time({
    limited$f(); limited$g() 
})