Uninett / zinolib

Python library for zino
Apache License 2.0
1 stars 3 forks source link

Silently ignore rogue event IDs #24

Closed podliashanyk closed 11 months ago

podliashanyk commented 1 year ago

There are instances where events state is not persisted properly. For example the situations when event is closed/removed, but its ID is still available in the events list. I am not sure why and what exactly happens, but it is out of scope of this issue. In zinolib this leads to zinolib.ritz.ProtocolError: (500, 'event "159589" does not exist') when fetching the events. Desktop client to zino crashes in presence of such events as well. While curitz silently ignores them and works as expected.

Traceback (most recent call last):
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 2213, in __call__
    return self.wsgi_app(environ, start_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 2193, in wsgi_app
    response = self.handle_exception(e)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 2190, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 1486, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/src/howitz/endpoints.py", line 168, in get_events
    table_events = get_current_events()
                   ^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/src/howitz/endpoints.py", line 51, in get_current_events
    event_engine.get_events()
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/zinolib/zino1.py", line 247, in get_events
    event = self.create_event_from_id(event_id)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/zinolib/zino1.py", line 252, in create_event_from_id
    attrlist = self._event_adapter.get_attrlist(self.session, event_id)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/zinolib/zino1.py", line 92, in get_attrlist
    return session.get_raw_attributes(event_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ilopod/Desktop/howitz/howitz/lib/python3.11/site-packages/zinolib/ritz.py", line 583, in get_raw_attributes
    raise ProtocolError(response.header)
zinolib.ritz.ProtocolError: (500, 'event "159589" does not exist')
hmpf commented 11 months ago

Closed by #18