Skip to content

Commit

Permalink
Fix: API request timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Jan 28, 2025
1 parent 2e72706 commit cd567a9
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions pkg/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,17 @@ func New(
opts ...ModuleOption,
) *Module {
module := Module{
BaseModule: modules.New("celestials"),
address: address,
states: state,
tx: tx,
celestials: v1.New(celestialsDatasource.URL),
indexerName: indexerName,
network: network,
indexPeriod: time.Minute,
databaseTimeout: time.Minute,
limit: 100,
BaseModule: modules.New("celestials"),
address: address,
states: state,
tx: tx,
celestials: v1.New(celestialsDatasource.URL),
indexerName: indexerName,
network: network,
indexPeriod: time.Minute,
databaseTimeout: time.Minute,
limit: 100,
celestialsDatasource: celestialsDatasource,
}

for i := range opts {
Expand Down Expand Up @@ -133,6 +134,8 @@ func (m *Module) getChanges(ctx context.Context) (celestials.Changes, error) {
}

func (m *Module) sync(ctx context.Context) error {
m.Log.Debug().Msg("start syncing...")

var end bool

for !end {
Expand Down Expand Up @@ -179,6 +182,8 @@ func (m *Module) sync(ctx context.Context) error {
}
end = len(changes.Changes) < int(m.limit)
}

m.Log.Debug().Msg("end syncing...")
return nil
}

Expand Down

0 comments on commit cd567a9

Please sign in to comment.