Skip to content

refactor(exchange_rate): replace eventual with watch#727

Merged
Theodus merged 1 commit intomainfrom
theodus/exchange-rate
May 8, 2024
Merged

refactor(exchange_rate): replace eventual with watch#727
Theodus merged 1 commit intomainfrom
theodus/exchange-rate

Conversation

@Theodus
Copy link
Member

@Theodus Theodus commented May 8, 2024

This is the first step in my intentions to move away from eventuals. Based on how we use them, they provide little value while making it difficult to observe using standard tokio runtime tools.

@Theodus Theodus requested a review from LNSD May 8, 2024 21:49
@Theodus Theodus force-pushed the theodus/exchange-rate branch from bf58385 to fa2b374 Compare May 8, 2024 21:56
@Theodus Theodus force-pushed the theodus/exchange-rate branch from fa2b374 to e8ee29e Compare May 8, 2024 21:57
Copy link
Contributor

@LNSD LNSD left a comment

Choose a reason for hiding this comment

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

LGTM ✅

@Theodus Theodus merged commit ab81ed1 into main May 8, 2024
@Theodus Theodus deleted the theodus/exchange-rate branch May 8, 2024 23:03
let (tx, mut rx) = watch::channel(NotNan::new(0.0).unwrap());
tokio::spawn(async move {
loop {
sleep(Duration::from_secs(60)).await;
Copy link
Contributor

Choose a reason for hiding this comment

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

I just noticed that putting the sleep at the beginning of the loop will cause an initial delay of 60 seconds to fetch the first update. This is not desirable. I'd rather put it at the end of the loop.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Theodus Theodus mentioned this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants