fix auto events
This commit is contained in:
@@ -116,12 +116,18 @@ export async function handlePluginRoutes(
|
|||||||
|
|
||||||
async function loadPluginOnConnectedClients(pluginId: string): Promise<void> {
|
async function loadPluginOnConnectedClients(pluginId: string): Promise<void> {
|
||||||
const allClients = clientManager.getAllClients();
|
const allClients = clientManager.getAllClients();
|
||||||
|
const autoEvents = deps.pluginState.autoStartEvents[pluginId];
|
||||||
for (const [clientId, client] of allClients) {
|
for (const [clientId, client] of allClients) {
|
||||||
if (deps.isPluginLoaded(clientId, pluginId) || deps.isPluginLoading(clientId, pluginId)) continue;
|
if (deps.isPluginLoaded(clientId, pluginId) || deps.isPluginLoading(clientId, pluginId)) continue;
|
||||||
try {
|
try {
|
||||||
const bundle = await deps.loadPluginBundle(pluginId, client.os, client.arch);
|
const bundle = await deps.loadPluginBundle(pluginId, client.os, client.arch);
|
||||||
deps.markPluginLoading(clientId, pluginId);
|
deps.markPluginLoading(clientId, pluginId);
|
||||||
deps.sendPluginBundle(client, bundle);
|
deps.sendPluginBundle(client, bundle);
|
||||||
|
if (autoEvents && autoEvents.length > 0) {
|
||||||
|
for (const evt of autoEvents) {
|
||||||
|
deps.enqueuePluginEvent(clientId, pluginId, evt.event, evt.payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
metrics.recordCommand("plugin_load");
|
metrics.recordCommand("plugin_load");
|
||||||
} catch {
|
} catch {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user