Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-populate event data in EventManager after re-connect #138

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/howitz/error_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ def handle_lost_connection(e):

connect_to_zino(current_user.username, current_user.token)

# Make sure that EventManager is populated with data after re-connect
current_app.event_manager.get_events()

hmpf marked this conversation as resolved.
Show resolved Hide resolved
# Re-fetch the event list and update event data in cache and session
# This is needed in case there were NTIE updates that occurred while connection was down, so that they are not lost until manual page refresh
events = current_app.event_manager.events
current_app.cache.set("events", events) # Update cache
session["event_ids"] = list(events.keys()) # Update session
session["events_last_refreshed"] = None # Mark current event table in UI as outdated
session.modified = True

alert_random_id = str(uuid.uuid4())
try:
short_err_msg = e.args[0]
Expand Down