Fix time delta handling when resuming from pause#24218
Conversation
With this code it will not create false alarm now it will warn only on disconnect.
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
kfc35
left a comment
There was a problem hiding this comment.
Please make sure to cargo fmt --all as well!
| pub use time::*; | ||
| pub use timer::*; | ||
| pub use virt::*; | ||
| use crossbeam_channel::TryRecvError; |
There was a problem hiding this comment.
crossbeam is only available with the std feature
| use crossbeam_channel::TryRecvError; | |
| #[cfg(feature = "std")] | |
| use crossbeam_channel::TryRecvError; |
(or you could just specify e.g. TryRecvError::Empty below with
crossbeam_channel::TryRecvError::Empty, same for Disconnected)
|
please make the PR title standalone. It will be used as the commit message if merged in main |
|
I have changed the title pls check. |
|
@kfc35 could you merge this pr today. I have synced this with master branch. Please merge this before any merge conflict comes for me. I hope you understand the situation. |
|
Sorry @octocamocoder47 I’m not a maintainer so I don’t have merge permissions even if I did, we usually require two approvals from two different reviewers before a PR is approved for merging |
| None | ||
| } | ||
| None => None, | ||
| Some(Err(TryRecvError::Empty)) | None => None, |
There was a problem hiding this comment.
This fix doesn't seem quite right. The rendering world should under normal circumstances always send a new time to the main world. If it doesn't then we want a warning. You probably need to special case when the time is paused.
With this code it will not create false alarm now it will warn only on disconnect.
Objective
Fixes #24160
When using pipelined rendering, the
time_systemwas throwing false warning messages about the render world not sending time updates. This happened even when everything was working fine it just occurred because there was a delay between app updates. The warning was meant to catch real problems, but it was triggering too often.Solution
I fixed it by not warning on any error from the channel, we now only warn when the channel is actually disconnected (meaning the render world truly stopped communicating). If the channel is just empty—which happens normally in pipelined rendering when the render thread hasn't sent a new frame yet we just move on without complaining.
Testing
I ran the tests and everything passes!
What Changed
The change is really small and focused in
crates/bevy_time/src/lib.rs. In thetime_systemfunction, I updated the error handling to: