MCPcopy Create free account
hub / github.com/foxcpp/maddy / StopAll

Method StopAll

framework/container/lifetime.go:139–158  ·  view source on GitHub ↗

StopAll calls Stop for all registered LifetimeModule instances.

()

Source from the content-addressed store, hash-verified

137
138// StopAll calls Stop for all registered LifetimeModule instances.
139func (lt *LifetimeTracker) StopAll() error {
140 for i := len(lt.instances) - 1; i >= 0; i-- {
141 entry := lt.instances[i]
142
143 if !entry.started {
144 continue
145 }
146
147 if err := entry.mod.Stop(); err != nil {
148 lt.logger.Error("module stop failed", err,
149 "mod_name", entry.mod.Name(), "inst_name", entry.mod.InstanceName())
150 continue
151 }
152 lt.logger.DebugMsg("module stopped",
153 "mod_name", entry.mod.Name(), "inst_name", entry.mod.InstanceName())
154
155 entry.started = false
156 }
157 return nil
158}
159
160func NewLifetime(log *log.Logger) *LifetimeTracker {
161 return &LifetimeTracker{

Callers 2

StartAllMethod · 0.95
moduleStopFunction · 0.80

Calls 5

DebugMsgMethod · 0.80
StopMethod · 0.65
NameMethod · 0.65
InstanceNameMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected