shift-code icon indicating copy to clipboard operation
shift-code copied to clipboard

Cache codes from API, only fetch new ones after a certain amount of time

Open trs opened this issue 5 years ago • 0 comments

To help with server load from the API provided by shift.orcicorn.com, we should cache the available codes and only request new ones if the cache is old.

This occurs at 00:02, 06:02, 12:02 and 18:02 server-time ( New York, USA )


On redeem, we want to store the result. Time should probably be based on the meta.generated field. On the next redeem request, check if the current time in New York, USA is > 1 hour from the meta.generated. If it is, send the request. If not, use the cached codes.

trs avatar Mar 01 '20 21:03 trs