From 869f20635d66ffbf58c0c6843d0d704c31ca83cc Mon Sep 17 00:00:00 2001 From: Hiroshi Nishio Date: Mon, 18 Nov 2024 18:24:24 +0900 Subject: [PATCH] Update usage record when GitAuto asks back to users and finishes there --- services/gitauto_handler.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/gitauto_handler.py b/services/gitauto_handler.py index 91aade12..4de08dc0 100644 --- a/services/gitauto_handler.py +++ b/services/gitauto_handler.py @@ -184,6 +184,14 @@ async def handle_gitauto(payload: GitHubLabeledPayload, trigger_type: str) -> No messages=messages, base_args=base_args, mode="comment" ) if is_commented: + end_time = time.time() + supabase_manager.complete_and_update_usage_record( + usage_record_id=usage_record_id, + is_completed=True, # False is only for GitAuto's failure + token_input=token_input, + token_output=token_output, + total_seconds=int(end_time - current_time), + ) return # Create a remote branch