Fix fetch-classify INIT crash and thread-state writes #41
2 changed files with 9 additions and 4 deletions
|
|
@ -2,3 +2,6 @@ google-api-python-client>=2.197.0
|
|||
google-auth>=2.53.0
|
||||
python-ulid>=3.1.0
|
||||
requests>=2.34.2
|
||||
# Transitive dep not reliably resolved during bundling; absence breaks all
|
||||
# imports at INIT (Runtime.ImportModuleError, fetch-classify down 05-05→06-03)
|
||||
typing_extensions>=4.12
|
||||
|
|
|
|||
|
|
@ -71,9 +71,10 @@ def save_thread_state(thread_id, message, adam_email):
|
|||
"last_message_date = :now, "
|
||||
"subject = :subject, "
|
||||
"adam_last_reply_date = :now, "
|
||||
"ttl = :ttl "
|
||||
"#ttl = :ttl "
|
||||
"REMOVE unanswered_since"
|
||||
),
|
||||
ExpressionAttributeNames={"#ttl": "ttl"},
|
||||
ExpressionAttributeValues={
|
||||
":from_email": message["from_email"],
|
||||
":now": now_iso,
|
||||
|
|
@ -89,8 +90,9 @@ def save_thread_state(thread_id, message, adam_email):
|
|||
"last_message_date = :now, "
|
||||
"subject = :subject, "
|
||||
"unanswered_since = if_not_exists(unanswered_since, :now), "
|
||||
"ttl = :ttl"
|
||||
"#ttl = :ttl"
|
||||
),
|
||||
ExpressionAttributeNames={"#ttl": "ttl"},
|
||||
ExpressionAttributeValues={
|
||||
":from_email": message["from_email"],
|
||||
":now": now_iso,
|
||||
|
|
@ -252,7 +254,7 @@ def get_tasks(status_filter=None):
|
|||
|
||||
|
||||
def update_task_status(task_id, status):
|
||||
update_expr = "SET #s = :status, ttl = :ttl"
|
||||
update_expr = "SET #s = :status, #ttl = :ttl"
|
||||
expr_values = {":status": status, ":ttl": _ttl_90_days()}
|
||||
if status == "completed":
|
||||
update_expr += ", completed_at = :now"
|
||||
|
|
@ -261,7 +263,7 @@ def update_task_status(task_id, status):
|
|||
_get_table().update_item(
|
||||
Key={"pk": f"TASK#{task_id}", "sk": "TASK"},
|
||||
UpdateExpression=update_expr,
|
||||
ExpressionAttributeNames={"#s": "status"},
|
||||
ExpressionAttributeNames={"#s": "status", "#ttl": "ttl"},
|
||||
ExpressionAttributeValues=expr_values,
|
||||
)
|
||||
|
||||
|
|
|
|||
Reference in a new issue