Commit 3e1c137
committed
config_file: move refresh into
We are quite lazy in how we refresh our config file backend when
updating any of its keys: instead of just updating our in-memory
representation of the keys, we just discard the old set of keys
and then re-read the config file contents from disk. This refresh
currently happens separately at every callsite of `config_write`,
but it is clear that we _always_ want to refresh if we have
written the config file to disk. If we didn't, then we'd run
around with an outdated config file backend that does not
represent what we have on disk.
By moving the refresh into `config_write`, we are also able to
optimize the case where the config file is currently locked.
Before, we would've tried to re-read the file even if we have
only updated its cached contents without touching the on-disk
file. Thus we'd have unnecessarily stat'd the file, even though
we know that it shouldn't have been modified in the meantime due
to its lock.write function1 parent d7f58ea commit 3e1c137
1 file changed
+6
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
289 | 287 | | |
290 | 288 | | |
291 | 289 | | |
| |||
352 | 350 | | |
353 | 351 | | |
354 | 352 | | |
355 | | - | |
356 | | - | |
357 | 353 | | |
358 | 354 | | |
359 | 355 | | |
| |||
385 | 381 | | |
386 | 382 | | |
387 | 383 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | 384 | | |
392 | 385 | | |
393 | 386 | | |
| |||
426 | 419 | | |
427 | 420 | | |
428 | 421 | | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | 422 | | |
433 | 423 | | |
434 | 424 | | |
| |||
1208 | 1198 | | |
1209 | 1199 | | |
1210 | 1200 | | |
1211 | | - | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
1212 | 1207 | | |
1213 | 1208 | | |
1214 | 1209 | | |
| |||
0 commit comments