Commit 4cd6b8b
committed
🐛 fix(watcher): suppress watcher snapshot when container enumeration fails (#362)
A transient docker / socket-proxy hiccup on a remote agent
(\`this.getContainers()\` throws) was logged as a warning but the
watch cycle continued and \`event.emitWatcherSnapshot\` was still
called with \`containers: []\`. On the controller side that
snapshot is authoritative — \`AgentClient.handleWatcherSnapshotEvent\`
calls \`pruneOldContainers([], watcherName)\`, which deleted every
container for that agent's watcher from the controller's store.
The agent's own store was untouched, so the agent's next cron
still logged "25 containers watched", but the controller UI
showed 0 for that agent until the next clean cron cycle landed
or the controller was restarted.
The watcher now records whether enumeration failed and skips the
snapshot emit in that case so the controller keeps its last-known
state across transient enumeration errors. Per-container events
still fire normally for any containers that were successfully
enumerated; only the empty-list-prune-everything path is closed.1 parent 6953b43 commit 4cd6b8b
3 files changed
Lines changed: 43 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
| 1077 | + | |
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
| |||
1086 | 1087 | | |
1087 | 1088 | | |
1088 | 1089 | | |
| 1090 | + | |
1089 | 1091 | | |
1090 | 1092 | | |
1091 | 1093 | | |
| |||
1120 | 1122 | | |
1121 | 1123 | | |
1122 | 1124 | | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
1132 | 1141 | | |
1133 | 1142 | | |
1134 | 1143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
362 | 385 | | |
363 | 386 | | |
364 | 387 | | |
| |||
0 commit comments