Add sync delay, to tune the speed of hits on the Todoist API.

master
Andrew Williams 2014-11-15 19:56:37 +00:00
parent f077053bb2
commit 3db98d186f
2 changed files with 7 additions and 1 deletions

View File

@ -12,5 +12,10 @@
"description": "The Todoist label to use for next actions.",
"value": "next_action",
"required": false
},
"TODOIST_SYNC_DELAY": {
"description": "The number of seconds to wait between syncs.",
"value": "5",
"required": false
}
}

View File

@ -13,6 +13,7 @@ import sys
API_TOKEN = os.environ.get('TODOIST_API_KEY', None)
NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action')
SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5'))
TODOIST_VERSION = '5.3'
@ -393,7 +394,7 @@ def main():
logging.info("*** Data built")
mods = singleton.GetProjectMods()
if len(mods) == 0:
time.sleep(5)
time.sleep(SYNC_DELAY)
else:
logging.info("* Modifications necessary - skipping sleep cycle.")
logging.info("** Beginning sync")