fix: delete+recreate status post, file polling fallback
- StatusBox: delete+recreate instead of PUT to keep post at thread bottom (Mattermost clears pin on PUT and doesn't bump edited posts) - StatusBox: extends EventEmitter, emits 'post-replaced' events - StatusWatcher: 500ms file polling fallback (fs.watch unreliable on Docker bind mounts / overlay fs) - WatcherManager: handles post-replaced events to update activeBoxes - SessionMonitor: forgetSession() for idle session re-detection
This commit is contained in:
@@ -282,6 +282,18 @@ async function startDaemon() {
|
||||
logger.debug({ sessionKey }, 'Session removed from sessions.json');
|
||||
});
|
||||
|
||||
// ---- Post Replaced (delete+recreate) ----
|
||||
sharedStatusBox.on('post-replaced', (oldPostId, newPostId) => {
|
||||
// Update activeBoxes to point to new post ID
|
||||
for (var entry of activeBoxes.entries()) {
|
||||
if (entry[1].postId === oldPostId) {
|
||||
entry[1].postId = newPostId;
|
||||
logger.debug({ sessionKey: entry[0], oldPostId, newPostId }, 'Post replaced (delete+recreate)');
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// ---- Session Update (from watcher) ----
|
||||
watcher.on('session-update', (sessionKey, state) => {
|
||||
const box = activeBoxes.get(sessionKey);
|
||||
|
||||
Reference in New Issue
Block a user