You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/specs/time.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,24 +46,21 @@ flowchart TD
46
46
St[Start] --> B(Publish status: starting)
47
47
B --> C(Subscribe to cap/time/+/meta/source)
48
48
C --> D(Publish status: running)
49
-
D --> E{Wait for first time capability meta message or context done}
50
-
E -->|context done| Z[Publish status: stopped]
49
+
D --> E{Wait for first time capability meta message or scope done}
50
+
E -->|scope done| Z[Publish status: stopped]
51
51
E -->|first capability meta received| F(Extract uuid from meta topic)
52
-
F --> G(Subscribe to cap/time/uuid/state/synced)
53
-
G --> H(Consume retained state and apply sync state)
54
-
H --> I(Subscribe to cap/time/uuid/event/synced)
55
-
I --> J(Subscribe to cap/time/uuid/event/unsynced)
56
-
J --> K{Wait for state, synced event, unsynced event, or context done}
52
+
F --> G(Subscribe to cap/time/uuid/state/synced\ncap/time/uuid/event/synced\ncap/time/uuid/event/unsynced)
53
+
G --> H(Read single retained state message and apply sync state)
54
+
H --> H2(Unsubscribe from state/synced)
55
+
H2 --> K{Wait for synced event, unsynced event, or scope done}
57
56
K -->|synced event| L(Apply synced: retain svc/time/synced=true, emit transition event)
58
57
L --> K
59
58
K -->|unsynced event| M(Apply unsynced: retain svc/time/synced=false, emit transition event)
60
59
M --> K
61
-
K -->|state update| N(Apply state payload synced bool)
62
-
N --> K
63
-
K -->|context done| Z
60
+
K -->|scope done| Z
64
61
```
65
62
66
-
The retained `{'cap', 'time', <uuid>, 'state', 'synced'}` payload is consumed immediately after subscription to initialise sync state before any events arrive.
63
+
All three subscriptions are created before any message is read, so no events are lost during initialisation. The retained `{'cap', 'time', <uuid>, 'state', 'synced'}` payload is consumed as a one-shot read to bootstrap sync state, then the state subscription is dropped. Ongoing sync state changes are tracked exclusively through the `event/synced` and `event/unsynced` transition topics.
67
64
68
65
With the new fibers alarm API, the service calls:
69
66
-`alarm.set_time_source(fibers.utils.time.realtime)` on first synced state
0 commit comments