Commit c5d1766
committed
fix(connection-selection): cache history, fix symlink persistence, hermetic tests
Address three unresolved code-review issues from PR #1374:
- Cache ProgramSettings.get_connection_history() once at widget init as
_connection_history_cache instead of calling it (a disk read) on every
3-second periodic port-refresh cycle, preventing potential UI stalls on
slow disks or remote home directories.
- Update _connection_history_cache in-memory (prepend + deduplicate) in
both reconnect() and add_connection() after calling store_connection(),
keeping the cache consistent without further disk reads.
- Fix reconnect() to persist `selected_connection or device` instead of
always persisting self.flight_controller.comport.device. This avoids
storing resolved, unstable device paths (e.g. /dev/ttyACM0) when the
user explicitly selected a /dev/serial/by-id/* symlink, preventing
duplicates in the connection history.
- Patch ProgramSettings.store_connection in
test_periodic_refresh_stops_on_connection to prevent writes to the real
settings.json during tests, and assert the correct connection string was
persisted to verify the fix above.1 parent abd1d29 commit c5d1766
File tree
2 files changed
+26
-6
lines changed- ardupilot_methodic_configurator
- tests
2 files changed
+26
-6
lines changedLines changed: 21 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | | - | |
| 141 | + | |
140 | 142 | | |
141 | 143 | | |
142 | 144 | | |
| |||
211 | 213 | | |
212 | 214 | | |
213 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
| |||
261 | 267 | | |
262 | 268 | | |
263 | 269 | | |
264 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
265 | 276 | | |
266 | 277 | | |
267 | | - | |
268 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
269 | 284 | | |
270 | 285 | | |
271 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
991 | 991 | | |
992 | 992 | | |
993 | 993 | | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
994 | 997 | | |
995 | 998 | | |
996 | 999 | | |
| |||
1000 | 1003 | | |
1001 | 1004 | | |
1002 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
1003 | 1008 | | |
1004 | 1009 | | |
1005 | 1010 | | |
| |||
0 commit comments