Store updated profile in memory cache

master
Bob Mottram 2019-08-22 18:33:04 +01:00
parent 5891f2ae12
commit 49d087a911
1 changed files with 3 additions and 1 deletions

View File

@ -609,7 +609,7 @@ def personReceiveUpdate(baseDir: str,nickname: str,domain: str,port: int, \
print('WARN: Public key does not match cached actor when updating')
return False
# save to cache in memory
personCache[personJson['id']]=personJson
storePersonInCache(baseDir,personJson['id'],personJson,personCache)
# save to cache on file
with open(actorFilename, 'w') as fp:
commentjson.dump(personJson, fp, indent=4, sort_keys=False)
@ -648,6 +648,8 @@ def receiveUpdate(session,baseDir: str, \
if messageJson['object']['type']=='Person':
if messageJson['object'].get('url') and messageJson['object'].get('id'):
domain,tempPort=getDomainFromActor(messageJson['actor'])
nickname=getNicknameFromActor(messageJson['actor'])
if personReceiveUpdate(baseDir,nickname,domain,port, \
messageJson['object'], \
personCache,debug):