From e5b90fd512efe983065a5765cf0ad9e38e7591ca Mon Sep 17 00:00:00 2001 From: 3decibels <3db@3decibels.net> Date: Sun, 4 Jun 2017 23:43:28 +0000 Subject: [PATCH] Added expiration of uuidcache entries Entries in the uuidcache will now be considered expired if they were retrieved before the mtime of the player dat file. This follows the recommendation made in issue #1279. --- overviewer_core/aux_files/genPOI.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/overviewer_core/aux_files/genPOI.py b/overviewer_core/aux_files/genPOI.py index 0fc5b8b..9fd8704 100755 --- a/overviewer_core/aux_files/genPOI.py +++ b/overviewer_core/aux_files/genPOI.py @@ -258,13 +258,15 @@ class PlayerDict(dict): sname = self._name.replace('-','') try: profile = PlayerDict.uuid_cache[sname] - return profile['name'] + if profile['retrievedAt'] > time.mktime(self['time']): + return profile['name'] except (KeyError,): pass try: profile = json.loads(urllib2.urlopen(UUID_LOOKUP_URL + sname).read()) if 'name' in profile: + profile['retrievedAt'] = time.mktime(time.localtime()) PlayerDict.uuid_cache[sname] = profile return profile['name'] except (ValueError, urllib2.URLError):