Skip to content

Fix time delta handling when resuming from pause#24218

Open
octocamocoder47 wants to merge 6 commits into
bevyengine:mainfrom
octocamocoder47:main
Open

Fix time delta handling when resuming from pause#24218
octocamocoder47 wants to merge 6 commits into
bevyengine:mainfrom
octocamocoder47:main

Conversation

@octocamocoder47
Copy link
Copy Markdown

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_system was 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 the time_system function, I updated the error handling to:

  • Ignore empty channel errors (these are totally normal)
  • Still warn about actual disconnections (when something is genuinely wrong)

With this code it will not create false alarm now it will warn only on disconnect.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

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 ✨

Copy link
Copy Markdown
Contributor

@kfc35 kfc35 left a comment

Choose a reason for hiding this comment

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

Please make sure to cargo fmt --all as well!

pub use time::*;
pub use timer::*;
pub use virt::*;
use crossbeam_channel::TryRecvError;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

crossbeam is only available with the std feature

Suggested change
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)

@kfc35 kfc35 added C-Bug An unexpected or incorrect behavior A-App Bevy apps and plugins D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward A-Time Involves time keeping and reporting X-Uncontroversial This work is generally agreed upon labels May 9, 2026
@mockersf
Copy link
Copy Markdown
Member

please make the PR title standalone. It will be used as the commit message if merged in main

@octocamocoder47 octocamocoder47 changed the title Fix for issue #24160 Fix time delta handling when resuming from pause May 10, 2026
@octocamocoder47
Copy link
Copy Markdown
Author

I have changed the title pls check.

@octocamocoder47
Copy link
Copy Markdown
Author

@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.

@kfc35
Copy link
Copy Markdown
Contributor

kfc35 commented May 13, 2026

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,
Copy link
Copy Markdown
Contributor

@hymm hymm May 13, 2026

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-App Bevy apps and plugins A-Time Involves time keeping and reporting C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delay after App::update triggers time_system warning

4 participants