fix(batch1): safe fixes — saveOffsets ordering, pid atomic, error handlers, go mutex, frontend cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user