Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
wraymo committed Jun 5, 2024
1 parent 7c94b57 commit 256c0a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ async def check_job_status_and_update_db(db_conn_pool, results_cache_uri):
error_msg = f"Unexpected msg_type: {msg.msg_type.name}"
raise NotImplementedError(error_msg)

# We set the status regardless of the job's previous status to handle the case where the
# job is cancelled (status = CANCELLING) while we're in this method.
if set_job_status(db_conn, job_id, new_job_status):
if new_job_status == SearchJobStatus.SUCCEEDED:
logger.info(f"Completed job {job_id}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ class SearchJobsDbManager {
await this.#sqlDbConnPool.query(
`UPDATE ${this.#searchJobsTableName}
SET ${SEARCH_JOBS_TABLE_COLUMN_NAMES.STATUS} = ${SEARCH_JOB_STATUS.CANCELLING}
WHERE ${SEARCH_JOBS_TABLE_COLUMN_NAMES.ID} = ?
AND ${SEARCH_JOBS_TABLE_COLUMN_NAMES.STATUS}
WHERE ${SEARCH_JOBS_TABLE_COLUMN_NAMES.ID} = ?
AND ${SEARCH_JOBS_TABLE_COLUMN_NAMES.STATUS}
IN (${SEARCH_JOB_STATUS.PENDING}, ${SEARCH_JOB_STATUS.RUNNING})`,
jobId,
);
Expand Down

0 comments on commit 256c0a0

Please sign in to comment.