Skip to content
TORNLIFE More

API Log improper caching

Started by KingLouisCLXXII [2070312] on in Bugs & Issues.

17 replies · 286 views · thread synced · 9 days ago · View on torn.com
About this thread

Posts archived: 18 / 18 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
18
Discussion span
→
People posting
9
Likes on archived posts
14
Posts by staff, officers and moderators
5
Authority score
61 / 100
Historical score
43 / 100
Story score
46 / 100
Engagement score
61 / 100

Most-liked replies

KingLouisCLXXII [2070312]
The log is caching when different to/from timestamps are passed to the same log query

For example: the following requests return the same thing if requested within 30 seconds. They should not.

https://api.torn.com/user/?selections=log&log=2536&to=1635404739&key=KEY
https://api.torn.com/user/?selections=log&log=2536&to=1630404728&key=KEY


Possible duplicate of this issue: https://www.torn.com/forums.php#/p=threads&f=19&t=16248187&b=0&a=0

Mentions: API is improperly caching when multiple item ID's

Chedburn [1] Admin Developer
This would be correct, that's working as intended. Otherwise the cache could just be bypassed by setting different timestamps constantly? This is more of an issue for other selections that utilize the 'to' timestamp.
Tux [2571279]
Was this cache for the log API introduced with the latest change? I have scripts that appeared to be functioning normally before the API rework but now don't seem to be behaving properly and wondering if it's related to this when the only thing I've changed is putting in the Full Access API Key. I haven't had the chance to look into it further though to confirm.

I should note that my scripts heavily utilize timestamps to loop through the log API.

If you're going to introduce a cache for the log API like this then can the limit be increased on how many results we can retrieve with one call or something?
KingLouisCLXXII [2070312]
I might be misunderstanding the purpose of the cache but is it not to reduce server load by not sending a request to the servers when a duplicate call is made? In this case, a call that should return different information is being cached.
Mr_Red [1693261]
This does appear to of been a bug introduced in the latest API version, up until this change I could request logs using the to field and get unique results up to the API requets limit per minute. Now it will only return the cached result for some length of time.

Example URL with issue -

https://api.torn.com/user/?selections=log&log=8354,8355,8359&to=1621583628&key=
https://api.torn.com/user/?selections=log&log=8354,8355,8359&to=1621583086&key=

This used to return one then the other, now it will continue to return the first query until the Cache clears which seems to take 15 seconds or so?

Until this change you could within the limits of the API return roughly 4,800 logs, now you would be lucky to get 400 or so per minute
AhmedH2O [2366301]
yeah this really annoying I've been banging my head to the desk for the last week because my script to calculate revives isn't working (infinite loop) because i use the last timestamp as the new timestamp in the new query and the results doesn't seem to stop because i get the same result from the last search so it keeps going forever
AhmedH2O [2366301]
It doesn't seem that it have changed (I use Selection=Revive, not the logs) and I still get the same results if requested within 30 secs