Open carlaKC opened 1 year ago
@carlaKC (or perhaps @orbitalturtle, who is currently more active).
What are your thoughts on using Tokio's built-in testing features(such as advance
method)?
This approach differs from what you suggested earlier, but it allows us to manage time without relying on mocking.
Description
47 introduced a basic rate limiting implementation with some unit tests, but they're not ideal. One of the main limitations here is around the mocking we have in place for the clock:
checkpoint
it between calls to set different return values, which requires a mutable reference.clone
, so once we create atTokenLimiter
we can't checkpoint it (since it's moved on creation).Steps to Complete
duration_since
method to theClock
trait, which can be more easily mocked (though still suffers similar issues) - perhaps stealing ideas from LDK