1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! In-process request for a graceful restart.
//!
//! An admin action that swaps the services root cannot take effect in the
//! running process: the loader, the router and every cached catalog were
//! built from the old tree. Rather than rebuild them in place, the handler
//! asks the process to drain and exit, and the supervisor starts it again on
//! the new composition.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.
use Arc;
use Notify;
/// Handle used to ask the running process to drain and exit.
///
/// One handle is created at the composition root and shared by clone between
/// the [`super::AppContext`] and the server's shutdown selector; the server
/// binds its listener before the context exists, so both must be handed the
/// same handle rather than each making its own. A request raised before
/// anyone is waiting is held as a permit and delivered to the first waiter,
/// so a restart asked for during boot is not lost.