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
# 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'
if not os.path.isfile(cacheFilename):
with open(cacheFilename, 'w') as fp:

View File

@ -2934,6 +2934,12 @@ def runDaemon(projectVersion, \
print('Creating shared inbox: inbox@'+domain)
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')
httpd.thrInboxQueue= \
threadWithTrace(target=runInboxQueue, \

View File

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