fix(backend): handle BatchSessionNotFoundException in BatchManager._process()

The internal `BatchProcessStorage.get_session()` method throws when it finds nothing, but we were not catching any exceptions.

This caused a exception when the batch manager handles a `graph_execution_state_complete` event that did not originate from a batch.

Fixed by handling the exception.
This commit is contained in:
psychedelicious 2023-08-17 13:58:11 +10:00
parent e62d5478fd
commit 59bc9ed399

View File

@ -71,8 +71,9 @@ class BatchManager(BatchManagerBase):
async def _process(self, event: Event, err: bool) -> None:
data = event[1]["data"]
batch_session = self.__batch_process_storage.get_session(data["graph_execution_state_id"])
if not batch_session:
try:
batch_session = self.__batch_process_storage.get_session(data["graph_execution_state_id"])
except BatchSessionNotFoundException:
return None
changes = BatchSessionChanges(state="error" if err else "completed")
batch_session = self.__batch_process_storage.update_session_state(