···2424 });
2525 }
26262727+ // if this host is already running, everything is already ok
2828+ if hydrant.firehose.is_source_running(&url) {
2929+ return Ok(StatusCode::OK);
3030+ }
3131+2732 // enforce daily new pds limit on unknown hosts
2833 if !hydrant.firehose.is_source_known(&url) {
2934 let (allowed, to_persist) = hydrant.state.pds_daily_limit.try_increment();
+10-5
src/control/firehose.rs
···151151 *self.state.firehose_enabled.borrow()
152152 }
153153154154- /// returns `true` if this URL is already a known firehose source — either currently
155155- /// running or persisted (e.g. the host is offline but was previously added).
154154+ /// returns `true` if this URL is already a known firehose source.
155155+ /// either currently running or persisted (e.g. the host is offline but was previously added).
156156 pub fn is_source_known(&self, url: &Url) -> bool {
157157 self.known_sources.contains_sync(url)
158158 }
159159160160+ /// return `true` if this source has a running firehose task (eg. its not offline).
161161+ pub fn is_source_running(&self, url: &Url) -> bool {
162162+ self.tasks.contains_sync(url)
163163+ }
164164+160165 /// list all currently active firehose sources.
161166 pub async fn list_sources(&self) -> Vec<FirehoseSourceInfo> {
162162- let mut out = Vec::new();
167167+ let mut out = Vec::with_capacity(self.tasks.capacity());
163168 self.tasks
164164- .any_async(|url, handle| {
169169+ .iter_async(|url, handle| {
165170 out.push(FirehoseSourceInfo {
166171 url: url.clone(),
167172 is_pds: handle.is_pds,
168173 });
169169- false
174174+ true
170175 })
171176 .await;
172177 out