Sync users progressively throughout the day instead of all in one go
This should lower the load on the server considerably
I'm not quite sure if the caches will be correct when you recalculate them for "last 24h" every 2 minutes for a single user.
The full cache rebuilds will happen for one user every 2 minutes, ie. 720 users a day. That sounds like pretty much enough to me.
It should check that the user cache is older than 24 hrs when it's updated. But obviously then it should use the last cache time and not 24 hrs as limit.
And now that I think of it, what is the point of doing it at all if the cache is updated when the profile is viewed and when the full cache run hits every few days anyway? Damn what was I thinking writing this?
I will improve this next week and get rid of the 24 hrs part as unnecessary.
Yeah I'm pretty sure eg. the hour data is like
12-13 30 13-14 23 ...
and when you have a pulse with, say, 2xp today at 13:34 it's going to be added every time the last 24 hour job runs. Which can be every 2 minutes if you're active and few other people are.
I think the only safe ways to work with the cache is to add values after the previous cache generation or a full rebuild.
Right. Disregard my last message. :)