Merge pull request #43702 from thaJeztah/daemon_event_simplify

daemon: LogDaemonEventWithAttributes: don't call SystemInfo()
This commit is contained in:
Sebastiaan van Stijn 2022-06-08 02:25:23 +02:00 committed by GitHub
commit 20d6b5c1bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View file

@ -87,14 +87,13 @@ func (daemon *Daemon) LogNetworkEventWithAttributes(nw libnetwork.Network, actio
// LogDaemonEventWithAttributes generates an event related to the daemon itself with specific given attributes.
func (daemon *Daemon) LogDaemonEventWithAttributes(action string, attributes map[string]string) {
if daemon.EventsService != nil {
if info := daemon.SystemInfo(); info.Name != "" {
attributes["name"] = info.Name
if name := hostName(); name != "" {
attributes["name"] = name
}
actor := events.Actor{
daemon.EventsService.Log(action, events.DaemonEventType, events.Actor{
ID: daemon.id,
Attributes: attributes,
}
daemon.EventsService.Log(action, events.DaemonEventType, actor)
})
}
}

View file

@ -42,10 +42,6 @@ func (daemon *Daemon) Reload(conf *config.Config) (err error) {
})
logrus.Infof("Reloaded configuration: %s", jsonString)
}
// we're unlocking here, because
// LogDaemonEventWithAttributes() -> SystemInfo() -> GetAllRuntimes()
// holds that lock too.
daemon.configStore.Unlock()
if err == nil {
daemon.LogDaemonEventWithAttributes("reload", attributes)