Make timeout_btw_accounts configurable

This commit is contained in:
Bofh 2021-02-09 12:08:37 +01:00
parent 02a59cc385
commit b3103c22c5
2 changed files with 6 additions and 2 deletions

View File

@ -6,6 +6,9 @@
// maximum video size in MB (depends MAX_PHOTO_SIZE Pixelfed) // maximum video size in MB (depends MAX_PHOTO_SIZE Pixelfed)
"max_video_size": 30, "max_video_size": 30,
// time to sleep between account updates
"timeout_btw_accounts": 20,
// time to sleep between posts successfull updates // time to sleep between posts successfull updates
"timeout_btw_posts": 0 "timeout_btw_posts": 0
} }

View File

@ -82,11 +82,12 @@ def update_allaccounts_async():
def update_allaccounts(): def update_allaccounts():
# update all accounts with a timeout of 20 seconds # update all accounts with a timeout of 20 seconds
sleeptime = int(config()['timeout_btw_accounts'])
for acc_id in os.listdir('./db/accounts'): for acc_id in os.listdir('./db/accounts'):
print('I| mirroring account "{}"...'.format(acc_id)) print('I| mirroring account "{}"...'.format(acc_id))
update_igaccount(acc_id) update_igaccount(acc_id)
print('I| timeout 20 seconds') print('I| timeout {} seconds'.format(sleeptime))
time.sleep(20) time.sleep(sleeptime)
print() print()
print('I| done updating all accounts') print('I| done updating all accounts')