SuperEvilMegacorp / vainglory-assets

Community provided art, schemas, and other assets that make using the Vainglory API easier
https://developer.vainglorygame.com
MIT License
54 stars 40 forks source link

Question: Why is the max search time 28 days? #249

Closed schneefux closed 7 years ago

schneefux commented 7 years ago

The max search time span between createdAt-start and createdAt-end is 28 days

Debugging #248, I tried the following query:

curl -g "https://api.dc01.gamelockerapp.com/shards/eu/matches?filter[playerNames]=shutterfly&filter[gameMode]=casual_aral,blitz_pvp_ranked&sort=createdAt&filter[createdAt-start]=2017-05-01T00:00:00.000Z&filter[createdAt-end]=2017-05-31T23:59:99.999Z" -H "Authorization: Bearer $APIKEY" -H "X-TITLE-ID: semc-vainglory" -H "Accept: application/vnd.api+json"

2017-05-01 to 2017-05-31 is more than 28 days, and this query succeeds. Adding 1ns makes the query fail. Is this intended?

schneefux commented 7 years ago

The real question is, is it


I found this comment from @bguilder on Discord:

Since we shard by month, 28 days ensures you will never be searching more than 2 indices

If you are still doing it that way and that concern is the only reason, you can safely increase the maximum interval to 31d + 28d - 1s, allowing API clients to query in intervals of 1 month (28-31 days) instead of 4 weeks (28 days).

(Shortest month + maximum interval 2017-02-01 + 55d = 2017-03-31 is still within 2 shards. There is no shorter two month span than February [28] + March [31].)

The current limitation has the following problem: Paginating 4 week intervals makes it impossible to get one full shard per query. Say I want shutterfly's data from February to now, I currently query:

2017-02-01 +28d
2017-03-01 +28d
2017-03-29 +28d
2017-04-26 +28d

It would be better for you and for us if we could do this:

2017-02-01 +28d
2017-03-01 +31d
2017-04-01 +30d
2017-05-01 +31d
svperfecta commented 7 years ago

Hey dudes - It's exactly 28 days or 4 weeks. Yes, you can't go larger than 28 days or you'll fail the query validator. If there's a bug with this, we're happy to fix it, but I think this is really just unhappiness about the way it works. I don't think the typical use case it to query by month. It's either to pull (daily, or periodically) updates for a player, or to potentially pull N weeks of historical matches. I think this is mostly arbitrary, and I guess I'm not sure why this really matters that much.

schneefux commented 7 years ago

Did you read this too? 😃

Debugging #248, I tried the following query: 2017-05-01 to 2017-05-31 is more than 28 days, and this query succeeds. Adding 1ns makes the query fail.

curl -g "https://api.dc01.gamelockerapp.com/shards/eu/matches?filter[playerNames]=shutterfly&filter[gameMode]=casual_aral,blitz_pvp_ranked&sort=createdAt&filter[createdAt-start]=2017-05-01T00:00:00.000Z&filter[createdAt-end]=2017-05-31T23:59:99.999Z" -H "Authorization: Bearer $APIKEY" -H "X-TITLE-ID: semc-vainglory" -H "Accept: application/vnd.api+json"

you can safely increase the maximum interval to 31d + 28d - 1s, allowing API clients to query in intervals of 1 month (28-31 days) instead of 4 weeks (28 days).