Create actor cache when daemon starts

master
Bob Mottram 2019-08-20 11:10:33 +01:00
parent 9b39bfee94
commit 97799f1db2
3 changed files with 17 additions and 8 deletions

View File

@ -22,10 +22,6 @@ def storePersonInCache(baseDir: str,personUrl: str,personJson: {},personCache: {
return return
# store to file # store to file
if not os.path.isdir(baseDir+'/cache'):
os.mkdir(baseDir+'/cache')
if not os.path.isdir(baseDir+'/cache/actors'):
os.mkdir(baseDir+'/cache/actors')
cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json' cacheFilename=baseDir+'/cache/actors/'+personUrl.replace('/','#')+'.json'
if not os.path.isfile(cacheFilename): if not os.path.isfile(cacheFilename):
with open(cacheFilename, 'w') as fp: with open(cacheFilename, 'w') as fp:

View File

@ -2934,6 +2934,12 @@ def runDaemon(projectVersion, \
print('Creating shared inbox: inbox@'+domain) print('Creating shared inbox: inbox@'+domain)
createSharedInbox(baseDir,'inbox',domain,port,httpPrefix) createSharedInbox(baseDir,'inbox',domain,port,httpPrefix)
if not os.path.isdir(baseDir+'/cache'):
os.mkdir(baseDir+'/cache')
if not os.path.isdir(baseDir+'/cache/actors'):
print('Creating actors cache')
os.mkdir(baseDir+'/cache/actors')
print('Creating inbox queue') print('Creating inbox queue')
httpd.thrInboxQueue= \ httpd.thrInboxQueue= \
threadWithTrace(target=runInboxQueue, \ threadWithTrace(target=runInboxQueue, \

View File

@ -287,6 +287,11 @@ httpPrefix='https'
if args.http: if args.http:
httpPrefix='http' httpPrefix='http'
baseDir=args.baseDir
if baseDir.endswith('/'):
print("--path option should not end with '/'")
sys.exit()
if args.posts: if args.posts:
if '@' not in args.posts: if '@' not in args.posts:
print('Syntax: --posts nickname@domain') print('Syntax: --posts nickname@domain')
@ -313,10 +318,12 @@ if args.postsraw:
__version__) __version__)
sys.exit() sys.exit()
baseDir=args.baseDir # create cache for actors
if baseDir.endswith('/'): if not os.path.isdir(baseDir+'/cache'):
print("--path option should not end with '/'") os.mkdir(baseDir+'/cache')
sys.exit() if not os.path.isdir(baseDir+'/cache/actors'):
print('Creating actors cache')
os.mkdir(baseDir+'/cache/actors')
if args.domain: if args.domain:
domain=args.domain domain=args.domain