Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
Matvey-Kuk committed Nov 18, 2024
1 parent c63e469 commit 7daf2ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keep/api/core/demo_mode_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def get_or_create_correlation_rules(keep_api_key, keep_api_url):


def remove_old_incidents(keep_api_key, keep_api_url):
consider_old_timedelta = datetime.timedelta(minutes=30)
incidents_existing = requests.get(
f"{keep_api_url}/incidents",
headers={"x-api-key": keep_api_key},
Expand All @@ -89,7 +90,7 @@ def remove_old_incidents(keep_api_key, keep_api_url):
for incident in incidents_existing:
if datetime.datetime.strptime(
incident["creation_time"], "%Y-%m-%dT%H:%M:%S.%f"
).replace(tzinfo=timezone.utc) < (datetime.datetime.now() - datetime.timedelta(minutes=30)).astimezone(timezone.utc):
).replace(tzinfo=timezone.utc) < (datetime.datetime.now() - consider_old_timedelta).astimezone(timezone.utc):
incident_id = incident["id"]
response = requests.delete(
f"{keep_api_url}/incidents/{incident_id}",
Expand Down

0 comments on commit 7daf2ce

Please sign in to comment.