From 92c5c219bdfe8a273bbe4dda69e9e6804c5ce0d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Tue, 8 Mar 2022 09:51:45 +0100 Subject: [PATCH] Remove unnecessary exception flush_cache on readonly dbs --- tsih/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tsih/__init__.py b/tsih/__init__.py index 87b4d23..e382582 100644 --- a/tsih/__init__.py +++ b/tsih/__init__.py @@ -10,7 +10,7 @@ import tempfile logger = logging.getLogger(__name__) -__version__ = '0.1.5' +__version__ = '0.1.6' from collections import UserDict, namedtuple @@ -240,7 +240,7 @@ class History: The cache will be flushed at the end of the simulation, and when history is accessed. ''' if self.readonly: - raise Exception('DB in readonly mode') + return logger.debug('Flushing cache {}'.format(self.db_path)) with self.db: self.db.executemany("replace into history(dict_id, t_step, key, value) values (?, ?, ?, ?)", self._tups)