Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

refactor: pending txns don't wait to poll futures until interval elapses #49

Merged
merged 1 commit into from
Jul 10, 2020

Conversation

prestwich
Copy link
Collaborator

Motivation

The pending tx object always polled interval using ready! before checking the result of any pending API requests. This means that in addition to the rate-limiting behavior, API results would be ignored until the interval elapsed

Solution

Add intermediate Paused states. These states wait for the interval to elapse, and then kick off a new API request. I left in the immediate non-rate limited transition in checking receipt, as that can trigger at most once.

Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good catch - let's keep in mind that there might be some room for improvement in the hand-written futures by using ctx.waker().wake_by_ref() similarly to how it's done herehttps://github.com/gakonst/ethers-rs/blob/master/ethers-providers/src/stream.rs#L116-L120

@gakonst gakonst merged commit 320ab27 into master Jul 10, 2020
@gakonst gakonst deleted the pending-interval-fix branch July 10, 2020 06:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants