MCPcopy Create free account
hub / github.com/DoNewsCode/core / ProvideRunGroup

Method ProvideRunGroup

leader/dependency.go:81–94  ·  view source on GitHub ↗
(group *run.Group)

Source from the content-addressed store, hash-verified

79func (m out) Module() interface{} { return m }
80
81func (m out) ProvideRunGroup(group *run.Group) {
82 ctx, cancel := context.WithCancel(context.Background())
83 group.Add(func() error {
84 err := m.Election.Campaign(ctx)
85 if err != nil {
86 return err
87 }
88 <-ctx.Done()
89 return nil
90 }, func(err error) {
91 _ = m.Election.Resign(ctx)
92 cancel()
93 })
94}
95
96// DriverArgs is the argument for constructing new drivers.
97type DriverArgs struct {

Callers

nothing calls this directly

Calls 4

DoneMethod · 0.80
CampaignMethod · 0.65
ResignMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected