refactor: don't block price updates, but do fatal on error

This commit is contained in:
Derrick Hammer 2024-03-10 13:52:49 -04:00
parent 8c05180703
commit effb341418
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 10 deletions

View File

@ -213,17 +213,17 @@ func (p PriceTracker) init() error {
p.cron.RegisterService(p)
p.api = apisdkgo.NewSiaClient()
err := p.importPrices()
if err != nil {
p.logger.Error("failed to import prices", zap.Error(err))
return err
}
go func() {
err := p.importPrices()
if err != nil {
p.logger.Fatal("failed to import prices", zap.Error(err))
}
err = p.updatePrices()
if err != nil {
p.logger.Error("failed to update prices", zap.Error(err))
return err
}
err = p.updatePrices()
if err != nil {
p.logger.Fatal("failed to update prices", zap.Error(err))
}
}()
return nil
}