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

Make sure that uncertain connection state always shows error statusbar #154

Merged
merged 1 commit into from
Jul 5, 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
16 changes: 6 additions & 10 deletions src/howitz/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,20 +582,16 @@ def refresh_events():
def test_conn():
is_connection_ok = test_zino_connection()
caller_id = request.headers.get('HX-Target', None)
if is_connection_ok is False:
if not is_connection_ok:
current_app.logger.debug('Connection test failed showing error appbar')
if is_connection_ok is None: # Uncertain connection state
try: # Attempt a quiet reconnect
reconnect_to_zino()
except:
pass
return render_template('components/feedback/connection-status-bar/error-appbar-content.html',
error_message="Connection to Zino server is lost")

if is_connection_ok is None: # Uncertain connection state
try: # Attempt a quiet reconnect
reconnect_to_zino()
except:
pass
response = make_response()
response.headers['HX-Reswap'] = 'none'
return response

if caller_id == 'connection-error-content': # If connection should be restored after error
reconnect_to_zino()
current_app.logger.debug('Connection test OK, caller ID %s', caller_id)
Expand Down