Aleksey_WMDE added a comment.

The failure happened in code where we store a value with TTL 1s and next line try to get it back. The value was considered expired, so null was returned.

The failure, probably, happened because we use time() and $date->getTimestamp() which return integer values. So if we call SimpleCacheWithBagOStuff::set() when real time is 00:00:01.9999, time() will return 00:00:01, then we add 1 second to calculate the expire time and in the end effective TTL will be 0.0001 second - which is wrong.

Solution 1:
Use round(microtime(true)) instead of time(). Then, effective TTL will be at least 0.5 seconds.


TASK DETAIL
https://phabricator.wikimedia.org/T201453

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Aleksey_WMDE
Cc: Addshore, WMDE-leszek, Aleksey_WMDE, Krinkle, Aklapper, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, Volker_E, Wikidata-bugs, aude, Jdforrester-WMF, Mbch331, Jay8g, Krenair
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to