Skip to content

Commit d0a53cb

Browse files
docs: document delay_s for deferred boot services
1 parent d133464 commit d0a53cb

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

docs/apps/creating-apps.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ Apps can also declare **services** — background components that run at boot ti
8888
"classname": "MyBootService",
8989
"intent_filters": [
9090
{
91-
"action": "boot_completed"
91+
"action": "boot_completed",
92+
"delay_s": 120
9293
}
9394
]
9495
}
@@ -101,7 +102,7 @@ Each service entry has:
101102
|-------|-------------|
102103
| `entrypoint` | Path to the Python file (relative to the app root) |
103104
| `classname` | Name of the `Service` subclass in that file |
104-
| `intent_filters` | Array of `{ "action": "..." }` objects. Use `"boot_completed"` to run at startup |
105+
| `intent_filters` | Array of `{ "action": "...", "delay_s": N }` objects. Use `"boot_completed"` to run at startup. Optional `delay_s` (seconds) defers the import and start of the service; `0` or absent starts immediately |
105106

106107
Services that subscribe to `"boot_completed"` are started automatically during system boot, after the launcher is displayed. See the [Service documentation](../frameworks/service.md) for details on writing and using services.
107108

docs/architecture/boot-sequence.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ MicroPythonOS consists of several core components that initialize and manage the
1919
- `WifiBootService` — auto-connects WiFi in a background thread
2020
- `WebServerBootService` — starts the HTTP web server
2121
- `AIOReplService` — starts the asyncio REPL task
22-
- App-specific services (e.g., `OSUpdateService`)
22+
- App-specific services with `delay_s: 0` or no delay (e.g., `NostrBootService`, `MeshCoreBootService`)
23+
- Schedules **deferred boot services** — services declaring `delay_s` > 0 in their intent_filter are imported and started asynchronously after the delay, keeping non-critical module imports out of the boot path:
24+
- `AppStoreService` (120s delay)
25+
- `OSUpdateService` (90s delay)
2326
- Marks the current boot as successful (cancel rollback)
2427
- Starts the TaskManager (asyncio event loop)
2528

docs/frameworks/service.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Apps declare services in their `MANIFEST.JSON` under a `"services"` array:
125125
"entrypoint": "osupdate_boot_service.py",
126126
"classname": "OSUpdateService",
127127
"intent_filters": [
128-
{ "action": "boot_completed" }
128+
{ "action": "boot_completed", "delay_s": 90 }
129129
]
130130
}
131131
]
@@ -138,7 +138,7 @@ Each service entry requires:
138138
|-------|-------------|
139139
| `entrypoint` | Path to the Python file (relative to the app root) |
140140
| `classname` | Name of the Service subclass in that file |
141-
| `intent_filters` | Array of `{ "action": "..." }` objects. `"boot_completed"` triggers the service at startup |
141+
| `intent_filters` | Array of `{ "action": "...", "delay_s": N }` objects. `"boot_completed"` triggers the service at startup. Optional `delay_s` (seconds) defers the import and start of the service; `0` or absent starts immediately |
142142

143143
The corresponding service code:
144144

0 commit comments

Comments
 (0)