4 import simplejson as json
11 with open(CONFIG['db']) as f:
12 DATABASE = json.load(f)
14 logging.info('No database was found, making a new one.')
17 following = DATABASE.get('relay-list', [])
18 for inbox in following:
19 if urllib.parse.urlsplit(inbox).hostname in CONFIG['ap']['blocked_instances']:
20 following.remove(inbox)
21 DATABASE['relay-list'] = following
23 if 'actors' in DATABASE:
24 DATABASE.pop('actors')
26 async def database_save():
28 with open(CONFIG['db'], 'w') as f:
29 json.dump(DATABASE, f)
30 await asyncio.sleep(30)
33 asyncio.ensure_future(database_save())