fix: plugin bot user + await plugin detection before session scan
- Add EnsureBotUser on plugin activate (fixes 'Unable to find user' error) - Accept bot_user_id in create session request - Await plugin health check before starting session monitor (prevents race where sessions detect before plugin flag is set) - Plugin now creates custom_livestatus posts with proper bot user
This commit is contained in:
@@ -171,13 +171,17 @@ async function startDaemon() {
|
||||
logger: logger.child({ module: 'plugin-client' }),
|
||||
});
|
||||
|
||||
// Initial plugin detection
|
||||
pluginClient.isHealthy().then(function (healthy) {
|
||||
// Initial plugin detection (awaited before monitor starts — see below)
|
||||
try {
|
||||
var healthy = await pluginClient.isHealthy();
|
||||
usePlugin = healthy;
|
||||
logger.info({ usePlugin, url: config.plugin.url }, healthy
|
||||
? 'Plugin detected — using WebSocket rendering mode'
|
||||
: 'Plugin not available — using REST API fallback');
|
||||
});
|
||||
} catch (_detectErr) {
|
||||
usePlugin = false;
|
||||
logger.warn('Plugin detection failed — using REST API fallback');
|
||||
}
|
||||
|
||||
// Periodic re-detection
|
||||
setInterval(function () {
|
||||
|
||||
Reference in New Issue
Block a user