Skip to content

Commit

Permalink
Fix NoneType object error for worker result
Browse files Browse the repository at this point in the history
  • Loading branch information
abs51295 committed Apr 26, 2018
1 parent 2a411b5 commit 96564a8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ def retrieve_worker_result(external_request_id, worker):
except SQLAlchemyError:
session.rollback()
raise
result_dict = result.to_dict()
elapsed_seconds = (datetime.datetime.now() - start).total_seconds()
msg = "It took {t} seconds to retrieve {w} " \
"worker results for {r}.".format(t=elapsed_seconds, w=worker, r=external_request_id)
current_app.logger.debug(msg)

return result_dict
if result:
result_dict = result.to_dict()
elapsed_seconds = (datetime.datetime.now() - start).total_seconds()
msg = "It took {t} seconds to retrieve {w} " \
"worker results for {r}.".format(t=elapsed_seconds, w=worker, r=external_request_id)
current_app.logger.debug(msg)

return result_dict

return None


def get_session():
Expand Down

0 comments on commit 96564a8

Please sign in to comment.