perf(awards): build the logbook snapshot once, not once per caller
A field log showed three pulls of the same 123 615 QSOs inside ten seconds, the Go heap going 725 MB → 2213 MB → 2539 MB. It is released after the idle TTL, so not a leak — just the same work done three times with all three results alive at once. The cache lock was released before the logbook was read, so every caller that arrived during a build missed the cache and started its own. Opening the Awards panel does exactly that. One builder at a time now, with the usual re-check after taking the lock: the second and third caller wait out the seconds they were going to spend anyway, minus two round trips to the database. The slice is also sized from the previous build. Growing to 123 000 structs by doubling copies the whole thing a dozen times and holds the old and the new array together at each step, on the largest object OpsLog keeps. Also, the settings panel registry. The hook trap that broke the window when the power-supply panel was opened was headed off by a comment, and the comment did not survive contact with the next panel — so it is now structural. PanelHost is a module-scope component that calls the selected panel and is keyed by section: hooks inside a panel land in a component context that persists, section changes remount it so each gets a fresh and consistent hook list, and no panel state leaks into the next. Rendering the panels as <Panel /> instead — the obvious refactor — would have been wrong: they are nested inside SettingsModal and close over its state, so each parent render makes a new component TYPE and React would unmount and remount the panel on every keystroke.
This commit is contained in:
+6
-2
@@ -2,8 +2,12 @@
|
||||
{
|
||||
"version": "0.25.7",
|
||||
"date": "",
|
||||
"en": [],
|
||||
"fr": []
|
||||
"en": [
|
||||
"Opening the Awards panel no longer pulls the whole logbook several times at once — a large log briefly took gigabytes of memory."
|
||||
],
|
||||
"fr": [
|
||||
"Ouvrir le panneau Awards ne tire plus plusieurs fois le journal entier en même temps — un gros log occupait brièvement des gigaoctets de mémoire."
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "0.25.6",
|
||||
|
||||
Reference in New Issue
Block a user