mirror of
https://github.com/nikdoof/NextAction.git
synced 2025-12-13 09:42:21 +00:00
Add sync delay, to tune the speed of hits on the Todoist API.
This commit is contained in:
5
app.json
5
app.json
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user