fix asset loader preregistration for multiple assets (#9453)

# Objective

fix #9452

when multiple assets are queued to a preregistered loader, only one gets
unblocked when the real loader is registered.

## Solution

i thought async_channel receivers worked like broadcast channels, but in
fact the notification is only received by a single receiver, so only a
single waiting asset is unblocked. close the sender instead so that all
blocked receivers are unblocked.
This commit is contained in:
robtfm 2023-08-17 21:56:41 +01:00 committed by GitHub
parent e2ed42fd75
commit 8a8d43d224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,7 +236,7 @@ impl AssetServer {
loaders[existing_index] = MaybeAssetLoader::Ready(Arc::new(loader));
if let Some(sender) = maybe_sender {
// notify after replacing the loader
let _ = sender.send_blocking(());
let _ = sender.close();
}
} else {
loaders.push(MaybeAssetLoader::Ready(Arc::new(loader)));