Quaver/api-v2

server/stats error retrieving

Closed this issue · 4 comments

AiAe commented

Starting api it creates 3 new entries in db ping, quaver:total_mapsets, quaver:server:online_users and quaver:total_users, which means redis connection works fine.
Opening the server/stats route returns this error

msg="Error retrieving online user count from redis - strconv.Atoi: parsing \"\": invalid syntax"

I assume due to the fact that few of the stats are missing from redis?

time="2024-06-30T10:42:28Z" level=error msg="Error retrieving total score count from redis - strconv.Atoi: parsing \"\": invalid syntax"

Unsure why total scores would even fail to pull since the query is correct.

Swan commented

It’s because these values aren’t in Redis

  • The online user count comes from Z.
  • The total score count can be fixed by running in production mode 1 time (it has a very slow startup)

I’ll fix it so it returns 0 if it errors

AiAe commented
  1. Z is running so it should've been fine?
  2. Can't u just spawn background task to set the value so it does not take long time to startup
Swan commented
  1. Check redis and see if the key exists and matches. Maybe there’s a mismatch.
  2. We can do that sure but id still handle the error of course
Swan commented

Resolved

33b6f8e
7961f5b