-
Notifications
You must be signed in to change notification settings - Fork 5
fix(hotreload): dropping configuration channels is ignored by consumers #1594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -553,7 +553,7 @@ You can increase this limit with: | |
| tokio::select! { | ||
| _ = interval.tick() => scan_trigger.notify_one(), | ||
| _ = running.changed() => break, | ||
| _ = scan_interval.changed() => break, | ||
| _ = scan_interval.changed(), if scan_interval.has_changed().is_ok() => break, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- effective Tokio version ---'
rg -n 'tokio\s*=' Cargo.toml fact/Cargo.toml Cargo.lock 2>/dev/null || true
printf '%s\n' '--- interval reload path ---'
rg -n -C 6 'scan_interval|start_scan_notifier|time::interval' fact/src/host_scanner.rs fact/src/configRepository: stackrox/fact Length of output: 34357 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- notifier implementation ---'
sed -n '530,590p' fact/src/host_scanner.rs
printf '%s\n' '--- scan interval configuration contract ---'
sed -n '100,145p;225,242p' fact/src/config/mod.rs
printf '%s\n' '--- Tokio dependency declaration ---'
sed -n '25,45p' Cargo.tomlRepository: stackrox/fact Length of output: 5547 🌐 Web query:
💡 Result: Yes, calling tokio::time::interval or tokio::time::interval_at with a Duration of Duration::ZERO will cause the program to panic [1][2][3]. Both functions are explicitly documented to panic if the provided period is zero [1][3]. The implementation enforces this requirement using an assertion, as seen in the source code [2][4]: assert!(period > Duration::new(0, 0), " Citations:
Handle a zero interval after a live configuration update. When 🤖 Prompt for AI Agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May address this in a follow-up There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would you like me to create a GitHub issue for it? 🐇 You are interacting with an AI system. |
||
| } | ||
| } | ||
| } | ||
|
|
@@ -587,6 +587,7 @@ You can increase this limit with: | |
|
|
||
| task_set.spawn(async move { | ||
| info!("Starting host scanner..."); | ||
| let mut config_is_closed = false; | ||
|
|
||
| loop { | ||
| tokio::select! { | ||
|
|
@@ -684,9 +685,12 @@ You can increase this limit with: | |
| } | ||
| } | ||
| _ = scan_trigger.notified() => self.scan()?, | ||
| _ = self.paths.changed() => { | ||
| self.scan()?; | ||
| res = self.paths.changed(), if !config_is_closed => { | ||
| match res { | ||
| Ok(()) => self.scan()?, | ||
| Err(_) => config_is_closed = true, | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.