Skip to content

Commit

Permalink
use the right context.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Jan 12, 2023
1 parent 2fce182 commit a080b14
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions node/modules/actorevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var _ events.EventAPI = &EventAPI{}

func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecycle, *store.ChainStore, *stmgr.StateManager, EventAPI, *messagepool.MessagePool, full.StateAPI, full.ChainAPI) (*full.EthEvent, error) {
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, cs *store.ChainStore, sm *stmgr.StateManager, evapi EventAPI, mp *messagepool.MessagePool, stateapi full.StateAPI, chainapi full.ChainAPI) (*full.EthEvent, error) {
ctx := helpers.LifecycleCtx(mctx, lc)

ee := &full.EthEvent{
Chain: cs,
MaxFilterHeightRange: abi.ChainEpoch(cfg.MaxFilterHeightRange),
Expand All @@ -53,7 +55,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy

// Start garbage collection for filters
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
OnStart: func(context.Context) error {
go ee.GC(ctx, time.Duration(cfg.FilterTTL))
return nil
},
Expand All @@ -69,7 +71,7 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy
}

lc.Append(fx.Hook{
OnStop: func(ctx context.Context) error {
OnStop: func(context.Context) error {
return eventIndex.Close()
},
})
Expand Down Expand Up @@ -112,7 +114,6 @@ func EthEventAPI(cfg config.ActorEventConfig) func(helpers.MetricsCtx, fx.Lifecy

const ChainHeadConfidence = 1

ctx := helpers.LifecycleCtx(mctx, lc)
lc.Append(fx.Hook{
OnStart: func(context.Context) error {
ev, err := events.NewEventsWithConfidence(ctx, &evapi, ChainHeadConfidence)
Expand Down

0 comments on commit a080b14

Please sign in to comment.