diff --git a/plugins/README.md b/plugins/README.md index 27eec9a6a..e7cb38971 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -236,11 +236,11 @@ The output is optional on success. On error, return: To schedule tasks, plugins call these host functions (provided by Navidrome): -| Host Function | Parameters | Description | -|------------------------------|-----------------------------------------------|------------------------------------------| -| `scheduler_scheduleonetime` | `delay_seconds, payload, schedule_id` | Schedule a one-time callback | -| `scheduler_schedulerecurring`| `cron_expression, payload, schedule_id` | Schedule a recurring callback | -| `scheduler_cancelschedule` | `schedule_id` | Cancel a scheduled task | +| Host Function | Parameters | Description | +|-------------------------------|-----------------------------------------|-------------------------------| +| `scheduler_scheduleonetime` | `delay_seconds, payload, schedule_id` | Schedule a one-time callback | +| `scheduler_schedulerecurring` | `cron_expression, payload, schedule_id` | Schedule a recurring callback | +| `scheduler_cancelschedule` | `schedule_id` | Cancel a scheduled task | #### Manifest Permissions diff --git a/plugins/manager.go b/plugins/manager.go index b8abc3799..051853c9e 100644 --- a/plugins/manager.go +++ b/plugins/manager.go @@ -491,11 +491,13 @@ func (m *Manager) loadPlugin(name, wasmPath string) error { hostFunctions = append(hostFunctions, host.RegisterCacheHostFunctions(service)...) } - // Check if recompilation is needed (AllowedHosts or host functions) + // Check if the plugin needs to be recompiled with real host functions needsRecompile := len(pluginManifest.AllowedHosts) > 0 || len(hostFunctions) > 0 - // Recompile if needed + // Recompile if needed. It is actually not a "recompile" since the first compilation + // should be cached by wazero. We just need to do it this way to provide the real host functions. if needsRecompile { + log.Trace(m.ctx, "Recompiling plugin", "plugin", name) compiled.Close(m.ctx) compiled, err = extism.NewCompiledPlugin(m.ctx, pluginManifest, extismConfig, hostFunctions) if err != nil {