refactor: don't block price updates, but do fatal on error
This commit is contained in:
parent
8c05180703
commit
effb341418
|
@ -213,17 +213,17 @@ func (p PriceTracker) init() error {
|
||||||
p.cron.RegisterService(p)
|
p.cron.RegisterService(p)
|
||||||
p.api = apisdkgo.NewSiaClient()
|
p.api = apisdkgo.NewSiaClient()
|
||||||
|
|
||||||
|
go func() {
|
||||||
err := p.importPrices()
|
err := p.importPrices()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.logger.Error("failed to import prices", zap.Error(err))
|
p.logger.Fatal("failed to import prices", zap.Error(err))
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = p.updatePrices()
|
err = p.updatePrices()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.logger.Error("failed to update prices", zap.Error(err))
|
p.logger.Fatal("failed to update prices", zap.Error(err))
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue