tesaguri / pipitor

Listen on WebSub/Twitter streams and (re)Tweet the updates in real time.
GNU Affero General Public License v3.0
4 stars 0 forks source link

Sporadic test failure on `Subscriber` #2

Open tesaguri opened 3 years ago

tesaguri commented 3 years ago

Offending code in the test:

https://github.com/tesaguri/pipitor/blob/a664f9e5b2271e38a8bd80c534f4cba6ee003122/src/websub/subscriber.rs#L340-L350

The tokio::time::advance should trigger a subscription renewal and the hub listener should receive a subscription request, but in fact, the listener occasionally hangs.

If you uncomment the yield_now, the Scheduler's get_next_tick callback seems to fire before calling tokio::time::advance(), which is unexpected since the refresh_time has not passed then.

tokio-rs/tokio#2090 may be relevant, I guess.

tesaguri commented 3 years ago

Workaround for this was made by replacing the usage of pause()/advance() with actual sleep()s (2b2fb9cf8e34d7e678579a1697a874405ea83240), but this is definitely not great as it significantly delays the tests.