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 re.search('https://(.*)/inbox',inbox).group(1) in CONFIG['ap']['blocked_instances']:
20 following.remove(inbox)
21 DATABASE['relay-list'] = following
23 async def database_save():
25 with open(CONFIG['db'], 'w') as f:
26 json.dump(DATABASE, f)
27 await asyncio.sleep(30)
30 asyncio.ensure_future(database_save())