diff --git a/trytond/trytond/backend/sqlite/database.py b/trytond/trytond/backend/sqlite/database.py index ed8dc264e7..dc4863cd55 100644 --- a/trytond/trytond/backend/sqlite/database.py +++ b/trytond/trytond/backend/sqlite/database.py @@ -525,7 +525,11 @@ class Database(DatabaseInterface): self._conn.execute('PRAGMA foreign_keys = ON') self._conn.execute('PRAGMA journal_mode = WAL') self._conn.execute('PRAGMA synchronous = NORMAL') - self._conn.execute('PRAGMA optimize') + try: + self._conn.execute('PRAGMA optimize') + except DatabaseOperationalError: + # database may be locked + pass return self def _make_uri(self):