Skip to content

Conversation

@dvc94ch
Copy link
Contributor

@dvc94ch dvc94ch commented Nov 20, 2020

Based on #35, needed to use async-io in more places in libp2p.

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Nov 20, 2020

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Nov 23, 2020

@stjepang any comments? It's currently blocking a PR of mine.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this! The PR looks good, I would just request the following changes:

  1. Implement poll() by calling poll_next(). Treat a regular timer (at()/after()) as a stream (interval_at()) with a period of infinity.
  2. Add a unit test to tests/timer.rs

@dvc94ch

This comment has been minimized.

@dvc94ch dvc94ch requested a review from a user November 26, 2020 12:50
@ghost
Copy link

ghost commented Nov 26, 2020

Why is the first tick of a timer constructed by interval() immediate? setInterval() in javscript and Ticker in Go don't fire immediately, so I'm inclined to follow the same behavior here...

@dvc94ch

This comment has been minimized.

@dvc94ch
Copy link
Contributor Author

dvc94ch commented Nov 27, 2020

I think I agree, you can easily get the first tick with Timer::interval_at(Instant::now(), period)

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thank you!

@ghost ghost merged commit 75316e2 into smol-rs:master Nov 28, 2020
@dvc94ch
Copy link
Contributor Author

dvc94ch commented Nov 28, 2020

Can you release 1.3.0? Then I can update my PR's to libp2p.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant