rfindley said...But that doesn't account for if a user does lessons on a different device.I agreed at first, but if I'm not mistaken, that's covered by the four-hour limit. If you make a call from your PC and then do some lessons on your phone, no new reviews will be scheluded at a time anterior to that at which the PC will check again.
But to be totally honest, I considered the multi-device support for about two seconds before throwing it in the "asking too much" box.
Yeah, you're correct.
Sorry, I didn't express clearly... I was thinking about the fact that (if I understand your proposal correctly) you'd basically be doing a check once every 4hrs at least. And that really is a nice simple way to reduce server load.
I was adding an additional point to what you said, and unfortunately didn't include much of the detail to make that clear (... posting while sleepy ;^_^ ).
Since the script does a full load of the user's items, even once every 4hrs is a big load on the servers if the script becomes popular. As a low- to mid-level user, @DaisukeJigen will see reasonably fast response times to his own API queries. For higher-level users, one massive request for all vocab often fails because the API request times out before all the data can be fetched. For that reason, the Timeline script breaks it up into smaller requests of 5 levels per query... though 10 or 15 may be better if it's going to request every 4hrs.
To minimize server load, the Timeline script relies on the recent_unlocks request -- which is a very fast and light request -- to determine only the minimum number of item levels that need to be queried. Basically, just query the levels that have had unlocks, or which had reviews go by.
Timeline caches all the items, so it knows which levels have had reviews go by, and therefore which levels need to be re-queried. Since DaisukeJigen isn't storing the items, he could instead sort all the items by level, and find the 'next-review' per level. That way, as a review time goes by, you know which levels need to be re-queried. (hard to explain... I hope that was clear).
But, that's a fair amount of extra work, sooo... ^_^