mirror of https://github.com/kortix-ai/suna.git
Merge pull request #819 from escapade-mckv/fix-billing
fix(billing): fix billing calculation
This commit is contained in:
commit
8f4c6fe17e
|
@ -194,6 +194,8 @@ async def calculate_monthly_usage(client, user_id: str) -> float:
|
|||
start_time = datetime.fromisoformat(run['started_at'].replace('Z', '+00:00')).timestamp()
|
||||
if run['completed_at']:
|
||||
end_time = datetime.fromisoformat(run['completed_at'].replace('Z', '+00:00')).timestamp()
|
||||
if start_time < end_time - 7200:
|
||||
continue
|
||||
else:
|
||||
# if the start time is more than an hour ago, don't consider that time in total. else use the current time
|
||||
if start_time < now_ts - 3600:
|
||||
|
|
Loading…
Reference in New Issue