Skip to content

Commit

Permalink
fix: fail on non-success gohbem init
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio1988 committed Dec 27, 2024
1 parent 69cb60f commit 955b8ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 2 additions & 5 deletions decoder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package decoder

import (
"context"
"errors"
"fmt"
"math"
"strconv"
Expand Down Expand Up @@ -162,12 +161,12 @@ func initDataCache() {
go routeCache.Start()
}

func InitialiseOhbem() error {
func InitialiseOhbem() {
if config.Config.Pvp.Enabled {
log.Info("Initialising Ohbem for PVP")
if len(config.Config.Pvp.LevelCaps) == 0 {
log.Errorf("PVP level caps not configured")
return errors.New("PVP level caps not configured")
return
}
leagues := map[string]gohbem.League{
"little": {
Expand Down Expand Up @@ -199,14 +198,12 @@ func InitialiseOhbem() error {

if err := o.FetchPokemonData(); err != nil {
log.Errorf("ohbem.FetchPokemonData: %s", err)
return err
}

_ = o.WatchPokemonData()

ohbem = o
}
return nil
}

func ClearPokestopCache() {
Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,7 @@ func main() {
go db2.PromLiveStatsUpdater(dbDetails, cfg.Prometheus.LiveStatsSleep)
}

if decoder.InitialiseOhbem() != nil {
return
}
decoder.InitialiseOhbem()
decoder.LoadStatsGeofences()
InitDeviceCache()

Expand Down

0 comments on commit 955b8ef

Please sign in to comment.