forked from Furumi/furumi-web
Tell the account why its shared podcast is not published
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5b2973f958
commit
3a1c50e78e
9 files changed
+179
-46
No files matched your search
@@ -302,6 +302,8 @@ pub struct Federation {
|
||||
/// The running podcast-discovery overlay, readable without waiting for
|
||||
/// `running` (held while the node starts).
|
||||
podcast_dht: std::sync::Mutex<Option<Arc<PodcastDht>>>,
|
||||
/// The node runs, but the podcast-discovery overlay failed to start.
|
||||
podcast_discovery_failed: AtomicBool,
|
||||
sync_lock: tokio::sync::Mutex<()>,
|
||||
supervisor_started: AtomicBool,
|
||||
recovery_count: AtomicU64,
|
||||
@@ -338,6 +340,7 @@ pub fn handle() -> Arc<Federation> {
|
||||
pool: tokio::sync::OnceCell::new(),
|
||||
running: tokio::sync::Mutex::new(None),
|
||||
podcast_dht: std::sync::Mutex::new(None),
|
||||
podcast_discovery_failed: AtomicBool::new(false),
|
||||
sync_lock: tokio::sync::Mutex::new(()),
|
||||
supervisor_started: AtomicBool::new(false),
|
||||
recovery_count: AtomicU64::new(0),
|
||||
@@ -488,6 +491,8 @@ impl Federation {
|
||||
return Ok(false);
|
||||
}
|
||||
*lock(&self.podcast_dht) = None;
|
||||
self.podcast_discovery_failed
|
||||
.store(false, Ordering::Relaxed);
|
||||
stop_running(guard.take()).await;
|
||||
} else if recovery_only {
|
||||
tracing::warn!(network = %network_name, "retrying stopped federation service");
|
||||
@@ -642,6 +647,8 @@ impl Federation {
|
||||
tasks.extend(discovery.tasks);
|
||||
}
|
||||
*lock(&self.podcast_dht) = podcast_dht.clone();
|
||||
self.podcast_discovery_failed
|
||||
.store(podcast_dht.is_none(), Ordering::Relaxed);
|
||||
*guard = Some(Running {
|
||||
service,
|
||||
similarity_dht,
|
||||
@@ -692,6 +699,8 @@ impl Federation {
|
||||
async fn stop(&self) {
|
||||
let mut guard = self.running.lock().await;
|
||||
*lock(&self.podcast_dht) = None;
|
||||
self.podcast_discovery_failed
|
||||
.store(false, Ordering::Relaxed);
|
||||
stop_running(guard.take()).await;
|
||||
}
|
||||
|
||||
@@ -724,6 +733,12 @@ impl Federation {
|
||||
lock(&self.podcast_dht).clone()
|
||||
}
|
||||
|
||||
/// Whether the node runs but its podcast-discovery overlay could not
|
||||
/// start (`podcast_discovery()` is then `None` too).
|
||||
pub fn podcast_discovery_unavailable(&self) -> bool {
|
||||
self.podcast_discovery_failed.load(Ordering::Relaxed)
|
||||
}
|
||||
|
||||
async fn spawn_sync_soon(self: &Arc<Self>) {
|
||||
if let Ok(service) = self.service().await {
|
||||
let fed = Arc::clone(self);
|
||||
|
||||
Reference in new issue
Block a user