We have a scheduled task to check that all the jobs have completed, this will catch if an app is shut down and the job is complete yet, we only wait 10 seconds before forcing the app to shut down.

The task was raising a JobIncompleteError, yet it's not an error the task is performing it's task correctly and calling the appropriate task to restart the job.
Also used apply_sync to create the task instead of send_task.
This commit is contained in:
Rebecca Law
2020-07-22 17:00:20 +01:00
parent ec5eeac0aa
commit dd126df122
4 changed files with 29 additions and 83 deletions

View File

@@ -10,23 +10,6 @@ from app.authentication.auth import AuthError
from app.errors import InvalidRequest
class JobIncompleteError(Exception):
def __init__(self, message):
self.message = message
self.status_code = 500
def to_dict_v2(self):
return {
'status_code': self.status_code,
"errors": [
{
"error": 'JobIncompleteError',
"message": self.message
}
]
}
class TooManyRequestsError(InvalidRequest):
status_code = 429
message_template = 'Exceeded send limits ({}) for today'
@@ -91,10 +74,6 @@ def register_errors(blueprint):
current_app.logger.info(error)
return jsonify(json.loads(error.message)), 400
@blueprint.errorhandler(JobIncompleteError)
def job_incomplete_error(error):
return jsonify(error.to_dict_v2()), 500
@blueprint.errorhandler(NoResultFound)
@blueprint.errorhandler(DataError)
def no_result_found(e):