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

Method StartAll

framework/container/lifetime.go:66–87  ·  view source on GitHub ↗

StartAll calls Start for all registered LifetimeModule instances.

()

Source from the content-addressed store, hash-verified

64
65// StartAll calls Start for all registered LifetimeModule instances.
66func (lt *LifetimeTracker) StartAll() error {
67 for _, entry := range lt.instances {
68 if entry.started {
69 continue
70 }
71
72 lt.logger.DebugMsg("starting module",
73 "mod_name", entry.mod.Name(), "inst_name", entry.mod.InstanceName())
74
75 if err := entry.mod.Start(); err != nil {
76 if err := lt.StopAll(); err != nil {
77 lt.logger.Error("StopAll failed after Start fail", err)
78 }
79 return fmt.Errorf("failed to start module %v: %w",
80 entry.mod.InstanceName(), err)
81 }
82 lt.logger.DebugMsg("module started",
83 "mod_name", entry.mod.Name(), "inst_name", entry.mod.InstanceName())
84 entry.started = true
85 }
86 return nil
87}
88
89func (lt *LifetimeTracker) ReloadAll() error {
90 for _, entry := range lt.instances {

Callers 1

moduleStartFunction · 0.80

Calls 6

StopAllMethod · 0.95
DebugMsgMethod · 0.80
NameMethod · 0.65
InstanceNameMethod · 0.65
StartMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected