Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ and listed with their assets on the

### Fixed

- **A restart no longer ends the stack's daemon.** Since the daemon ends
with the last tree (0.41.0), a restart (`restart_on`, `devstack restart`,
a rebuild) could end it: between the service's stop and its start
nothing ran, and on Windows the stop takes seconds. The daemon ended in
that gap, and the dashboard and the CLI found no daemon until the next
`up`. A restart under way now counts as running.
- **Python creating `__pycache__` no longer restarts a dev server** (#463).
On Windows the OS reports a folder as modified when an entry appears in
it, beside the entry's own event; with a folder in `restart_on`
Expand Down
16 changes: 16 additions & 0 deletions crates/devstack-daemon/src/supervisor/candidate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,22 @@ mod tests {
panic!("late past the deadline at every try: {tries:?}");
}

/// A restart under way keeps the daemon: between its stop and its start
/// nothing of the service runs, and the daemon must not end there.
#[test]
fn a_restart_under_way_counts_as_running() {
let (_d, _rt, sup) = two_after_a_job();
assert!(!sup.runs_anything(), "nothing started");
*sup.restarts_under_way
.lock()
.unwrap()
.entry("a".into())
.or_default() += 1;
assert!(sup.runs_anything(), "a restart between its stop and start");
*sup.restarts_under_way.lock().unwrap().get_mut("a").unwrap() -= 1;
assert!(!sup.runs_anything());
}

/// A change reported after a restart began waits for the restart, past
/// its quiet period: the restart may have built it already (#233).
#[test]
Expand Down
10 changes: 10 additions & 0 deletions crates/devstack-daemon/src/supervisor/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ impl Supervisor {
pub fn runs_anything(&self) -> bool {
use crate::state::Status;
self.upping.load(Ordering::SeqCst) > 0
// A restart stops before it starts: between the two nothing of
// the service runs, and on Windows the stop takes seconds. The
// daemon ended there, and the start that followed ran in a
// daemon on its way out.
|| self
.restarts_under_way
.lock()
.unwrap()
.values()
.any(|n| *n > 0)
|| self
.slots
.lock()
Expand Down