summaryrefslogtreecommitdiff
path: root/Biz/PodcastItLater/Core.py
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-13 10:19:26 -0500
committerBen Sima <ben@bsima.me>2025-11-13 11:20:17 -0500
commitf1e893ef05b20059a1850bb0fef9103e10d9af20 (patch)
tree255128532a69d980beb6a589556c6da8b40e8081 /Biz/PodcastItLater/Core.py
parent7dbeda5aafc56427777c31489a2554e546417530 (diff)
Fix tests I think
amp worked on this overnight, and I cleaned it up a bit this morning. I think its all correct now.
Diffstat (limited to 'Biz/PodcastItLater/Core.py')
-rw-r--r--Biz/PodcastItLater/Core.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Biz/PodcastItLater/Core.py b/Biz/PodcastItLater/Core.py
index 1339a7d..15aff86 100644
--- a/Biz/PodcastItLater/Core.py
+++ b/Biz/PodcastItLater/Core.py
@@ -199,12 +199,19 @@ class Database: # noqa: PLR0904
"""Update job status and error message."""
with Database.get_connection() as conn:
cursor = conn.cursor()
- if status == "error":
- cursor.execute(
- "UPDATE queue SET status = ?, error_message = ?, "
- "retry_count = retry_count + 1 WHERE id = ?",
- (status, error, job_id),
- )
+ if error is not None:
+ if status == "error":
+ cursor.execute(
+ "UPDATE queue SET status = ?, error_message = ?, "
+ "retry_count = retry_count + 1 WHERE id = ?",
+ (status, error, job_id),
+ )
+ else:
+ cursor.execute(
+ "UPDATE queue SET status = ?, "
+ "error_message = ? WHERE id = ?",
+ (status, error, job_id),
+ )
else:
cursor.execute(
"UPDATE queue SET status = ? WHERE id = ?",