diff --git a/api/daily/common.go b/api/daily/common.go index 84b8167..4f6d393 100644 --- a/api/daily/common.go +++ b/api/daily/common.go @@ -91,14 +91,14 @@ func Init() error { scheduler.Start() if os.Getenv("AWS_ENDPOINT_URL_S3") != "" { - go func() { - for { - err = S3SaveMigration() - if err != nil { - return - } - } - }() + // go func() { + // for { + // err = S3SaveMigration() + // if err != nil { + // return + // } + // } + // }() } return nil diff --git a/api/savedata/update.go b/api/savedata/update.go index 64f20f4..94d8ffb 100644 --- a/api/savedata/update.go +++ b/api/savedata/update.go @@ -39,7 +39,7 @@ func Update(uuid []byte, slot int, save any) error { if save.TrainerId == 0 && save.SecretId == 0 { return fmt.Errorf("invalid system data") } - + ProcessSystemMetrics(save, uuid); err = db.UpdateAccountStats(uuid, save.GameStats, save.VoucherCounts) if err != nil { return fmt.Errorf("failed to update account stats: %s", err) @@ -51,6 +51,7 @@ func Update(uuid []byte, slot int, save any) error { if slot < 0 || slot >= defs.SessionSlotCount { return fmt.Errorf("slot id %d out of range", slot) } + ProcessSessionMetrics(save, uuid) return db.StoreSessionSaveData(uuid, save, slot) default: @@ -65,8 +66,10 @@ func ProcessSystemMetrics(save defs.SystemSaveData, uuid []byte) { func ProcessSessionMetrics(save defs.SessionSaveData, uuid []byte) { err := Cache.Add(fmt.Sprintf("session-%x-%d", uuid, save.GameMode), uuid, time.Minute*5) if err != nil { + log.Printf("already cached session") return } + log.Printf("increased game mode counter") switch save.GameMode { case 0: gameModeCounter.WithLabelValues("classic").Inc()