Skip to content

Commit 3eac9b9

Browse files
committed
Always round-up timing in seconds
because very fast operations still save the user time but may be recorded as 0 sec if they are too quick. Instead record them as 1 sec to indicate that we saved the caller some time.
1 parent 0c00770 commit 3eac9b9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

app/analytics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#
1010

1111
import os
12+
import math
1213
import time
1314

1415
from functools import wraps
@@ -32,7 +33,7 @@ def decorator(function):
3233
def wrapper(*args, **kwargs):
3334
start = time.time()
3435
result = function(*args, **kwargs)
35-
duration_in_secs = round(time.time() - start)
36+
duration_in_secs = math.ceil(time.time() - start)
3637

3738
# record the analytics *after* a function is done
3839
post(event_id, duration_in_secs)

0 commit comments

Comments
 (0)