mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-19 06:12:24 +02:00
Target is updated after all resolve tasks finish (#590)
Target is updated after all resolve tasks finish
This commit is contained in:
@@ -15,6 +15,8 @@ pub enum EventMessage {
|
||||
LibraryScanProgress(LibraryScanSummary),
|
||||
// Triggered when MetadataUpdateManager queue drains for an input
|
||||
InputMetadataUpdatesCompleted(Arc<str>),
|
||||
// Triggered when MetadataUpdateManager starts a new processing cycle for an input
|
||||
InputMetadataUpdatesStarted(Arc<str>),
|
||||
}
|
||||
|
||||
pub struct EventManager {
|
||||
|
||||
@@ -373,6 +373,11 @@ impl InputWorker {
|
||||
last_queue_log_at = Instant::now()
|
||||
.checked_sub(QUEUE_LOG_INTERVAL + Duration::from_secs(1))
|
||||
.unwrap_or_else(Instant::now);
|
||||
if let Some(app_state) = app_state_weak.as_ref().and_then(Weak::upgrade) {
|
||||
app_state
|
||||
.event_manager
|
||||
.send_event(EventMessage::InputMetadataUpdatesStarted(input_name.clone()));
|
||||
}
|
||||
debug!("Background metadata update queue has entries for input {input_name}; starting processing");
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,15 @@ impl UpdateGuard {
|
||||
.map(|permit| UpdateGuardPermit { _permit: permit })
|
||||
}
|
||||
|
||||
pub async fn acquire_playlist_lock(&self) -> Option<UpdateGuardPermit> {
|
||||
self.playlist
|
||||
.clone()
|
||||
.acquire_owned()
|
||||
.await
|
||||
.ok()
|
||||
.map(|permit| UpdateGuardPermit { _permit: permit })
|
||||
}
|
||||
|
||||
pub fn try_library(&self) -> Option<UpdateGuardPermit> {
|
||||
self.library
|
||||
.clone()
|
||||
|
||||
Reference in New Issue
Block a user