fix(batch1): safe fixes — saveOffsets ordering, pid atomic, error handlers, go mutex, frontend cleanup

This commit is contained in:
Xen
2026-03-09 19:43:30 +00:00
parent cc65f9b5ce
commit 0b39b39f3b
4 changed files with 81 additions and 10 deletions

View File

@@ -61,6 +61,13 @@ class LiveStatusPlugin {
window.__livestatus_updates[data.post_id] = update;
// Evict completed sessions from the update cache after 60s to prevent unbounded growth
if (data.status === 'done' || data.status === 'error' || data.status === 'interrupted') {
setTimeout(() => {
delete window.__livestatus_updates[data.post_id];
}, 60000);
}
// Notify post-specific listeners
const listeners = window.__livestatus_listeners[data.post_id];
if (listeners) {
@@ -82,7 +89,16 @@ class LiveStatusPlugin {
}
uninitialize(): void {
// Cleanup handled by Mattermost plugin framework
// Clear global listener and update stores to prevent accumulation across reloads
window.__livestatus_listeners = {};
window.__livestatus_updates = {};
// Unregister the custom post type component if it was registered
if (this.postTypeComponentId) {
// registry is not available here — Mattermost framework cleans up on deactivate.
// Clearing postTypeComponentId prevents stale references.
this.postTypeComponentId = null;
}
}
}