Skip to main content

drain_completed_decodes

Function drain_completed_decodes 

Source
pub fn drain_completed_decodes(
    server: ResMut<'_, AssetServer>,
    commands: Commands<'_, '_>,
    frame_dirty: Option<ResMut<'_, FrameDirty>>,
)
Expand description

Drains completed decodes from the result channel.

For each result:

  • Filters the path’s waiter list against per-entity request ids. Waiters whose snapshot id no longer matches their entity’s current RequestId have been superseded by a newer SetSrc and are silently dropped - they would race with the live decode.
  • If at least one waiter survives the filter: inserts the payload into the success or failure cache (LRU-bumping recency) and attaches the result component to every surviving waiter.
  • If no waiter survives: the result is dropped entirely (no cache insert). This kills the stale-decode race at the cache layer - a SetSrc-storm enqueues N transient decodes whose final results never poison the LRU with paths the runtime no longer cares about.