fixed time not being updated
This commit is contained in:
7
main.go
7
main.go
@@ -61,19 +61,18 @@ func housekeeping() {
|
||||
}
|
||||
|
||||
// update players from steam
|
||||
var lastUpdated time.Time
|
||||
var lastUpdated *time.Time
|
||||
err = rdc.Get(context.Background(), utils.CachePrefix+"last_updated_profiles", lastUpdated)
|
||||
if err != nil || time.Since(lastUpdated) >= (time.Hour*24) {
|
||||
if err != nil || time.Since(*lastUpdated) >= (time.Hour*24) {
|
||||
tPlayerNeedSteamUpdate, err := db.Player.Query().Where(
|
||||
player.SteamUpdatedLTE(time.Now().UTC().Add(dur * -1)),
|
||||
).All(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("[HK] Can't query players: %v", err)
|
||||
continue
|
||||
}
|
||||
|
||||
if len(tPlayerNeedSteamUpdate) > 0 {
|
||||
log.Infof("[HK] Updating %d profiles from steam", len(tPlayerNeedSteamUpdate))
|
||||
log.Infof("[HK] Updating %d profiles from steam (last update %s)", len(tPlayerNeedSteamUpdate), lastUpdated)
|
||||
_, err = utils.PlayerFromSteam(tPlayerNeedSteamUpdate, db, conf.Steam.APIKey, rL)
|
||||
if err != nil {
|
||||
log.Warningf("[HK] Unable to update profiles from steam: %v", err)
|
||||
|
Reference in New Issue
Block a user