Thumbnailer channel with capacity 0 bug (#1808)

Solve
This commit is contained in:
Ericson "Fogo" Soares 2023-11-23 15:10:44 -03:00 committed by GitHub
parent 43b4865914
commit 425c410c62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,7 +20,7 @@ use tokio::{
sync::{broadcast, oneshot, watch, Mutex},
time::{sleep, Instant},
};
use tracing::error;
use tracing::{error, trace};
use uuid::Uuid;
use super::{
@ -209,10 +209,14 @@ impl Thumbnailer {
#[inline]
async fn new_batch(&self, batch: BatchToProcess, kind: ThumbnailKind) {
self.thumbnails_to_generate_tx
.send((batch, kind))
.await
.expect("critical thumbnailer error: failed to send new batch");
if !batch.batch.is_empty() {
self.thumbnails_to_generate_tx
.send((batch, kind))
.await
.expect("critical thumbnailer error: failed to send new batch");
} else {
trace!("Empty batch received, skipping...");
}
}
#[inline]