love icon indicating copy to clipboard operation
love copied to clipboard

Expose an API to retrieve ALL users love counts over a time period

Open danielpops opened this issue 7 years ago • 2 comments

It would be great if the love service exposed an endpoint where you can get an aggregate count of ALL users send/received love counts over a time period. The query would be something conceptually like SELECT user, COUNT(sent), COUNT(received) FROM table WHERE date >= @start AND date <= @end

danielpops avatar Mar 02 '17 21:03 danielpops

The ugly truth of Google Query Language is that typical aggregation functions like COUNT(), SUM(), MAX(), etc. are not even included. To do something as simple as the leaderboard, there has to be a separate table holding weekly love counts. So this operation would require us to iterate over every love sent in the time range and count them up. Which is probably feasible for a small enough time range, but could end up running long and potentially consuming lots of memory, which is a problem because GAE kills requests after 10 seconds, or if they exceed 128 MB of memory.

It's objectively a good idea for a feature, but those are some of the problems we might run into while implementing it.

brenns10 avatar Mar 02 '17 21:03 brenns10

One thing I'd like for us to do eventually is move off of the old proprietary App Engine APIs. If we migrate to the flexible environment we could use a different datastore that has these capabilities. We could also move to Python 3.

That would be a pretty big task though.

sjaensch avatar Mar 20 '17 09:03 sjaensch