From 18164fdb160b385673d0384ee43d12e1954ac360 Mon Sep 17 00:00:00 2001 From: "Jeyrce.Lu" Date: Tue, 22 Mar 2022 18:10:35 +0800 Subject: [PATCH] perf: optimize alert plugin call(#886) (#891) --- src/server/engine/notify.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/engine/notify.go b/src/server/engine/notify.go index 9a112191..0cee497e 100644 --- a/src/server/engine/notify.go +++ b/src/server/engine/notify.go @@ -409,13 +409,15 @@ type Notifier interface { // call notify.so via golang plugin build // ig. etc/script/notify/notify.so func alertingCallPlugin(stdinBytes []byte) { + if !config.C.Alerting.CallPlugin.Enable { + return + } + if runtime.GOOS == "windows" { logger.Errorf("call notify plugin on unsupported os: %s", runtime.GOOS) return } - if !config.C.Alerting.CallPlugin.Enable { - return - } + p, err := plugin.Open(config.C.Alerting.CallPlugin.PluginPath) if err != nil { logger.Errorf("failed to open notify plugin: %v", err)