diff --git a/api/chalicelib/core/resources.py b/api/chalicelib/core/resources.py index 9873bd97e..e56c0cf74 100644 --- a/api/chalicelib/core/resources.py +++ b/api/chalicelib/core/resources.py @@ -4,6 +4,8 @@ from decouple import config def get_by_session_id(session_id, project_id, start_ts, duration): with pg_client.PostgresClient() as cur: + if duration is None or (type(duration) != 'int' and type(duration) != 'float') or duration < 0: + duration = 0 delta = config("events_ts_delta", cast=int, default=60 * 60) * 1000 ch_query = """\ SELECT diff --git a/ee/api/chalicelib/core/resources.py b/ee/api/chalicelib/core/resources.py index a1f966937..71e493a4d 100644 --- a/ee/api/chalicelib/core/resources.py +++ b/ee/api/chalicelib/core/resources.py @@ -6,6 +6,8 @@ from decouple import config def get_by_session_id(session_id, project_id, start_ts, duration): with ch_client.ClickHouseClient() as ch: + if duration is None or (type(duration) != 'int' and type(duration) != 'float') or duration < 0: + duration = 0 delta = config("events_ts_delta", cast=int, default=60 * 60) * 1000 ch_query = """\ SELECT