Skip to content

Commit

Permalink
disable schedule when the connection raise error
Browse files Browse the repository at this point in the history
  • Loading branch information
Signorini committed Dec 30, 2018
1 parent e26f24d commit 43194a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/tasks/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ def task_connections(name, _id, endpoint, source='discovery', method="GET", args

if resource.get_status() < 400:
result = resource.get_results()
msg = "Connection success - %s" % conn_id

if result.get('found', 0) == 1:
webhook_id = task_webhook.delay(name, _id, endpoint, source, method, args, chain)
return {'webhook_id': webhook_id}

else:
msg = "Connection issue - %s" % conn_id
task_deplete.delay(msg, _id)

return {'msg': msg, 'status_code': resource.get_status()}

0 comments on commit 43194a9

Please sign in to comment.