mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Log warning when plugin using Shared Channels APIs is uninstalled (#26262)
* don't log error every minute when plugin uninstalled
This commit is contained in:
parent
6541708a93
commit
1fb5c3b1cf
@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
@ -244,7 +245,16 @@ func (a *App) OnSharedChannelsSyncMsg(msg *model.SyncMsg, rc *model.RemoteCluste
|
||||
func (a *App) OnSharedChannelsPing(rc *model.RemoteCluster) bool {
|
||||
pluginHooks, err := getPluginHooks(a.GetPluginsEnvironment(), rc.PluginID)
|
||||
if err != nil {
|
||||
a.Log().Error("Ping for shared channels cannot get plugin hooks", mlog.String("plugin_id", rc.PluginID), mlog.Err(err))
|
||||
// plugin was likely uninstalled. Issue a warning once per hour, with instructions how to clean up if this is
|
||||
// intentional.
|
||||
if time.Now().Minute() == 0 {
|
||||
msg := "Cannot find plugin for shared channels ping; if the plugin was intentionally uninstalled, "
|
||||
msg = msg + "stop this warning using `/secure-connection remove --connectionID %s`"
|
||||
a.Log().Warn(fmt.Sprintf(msg, rc.RemoteId),
|
||||
mlog.String("plugin_id", rc.PluginID),
|
||||
mlog.Err(err),
|
||||
)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user