Skip to content

Commit 4613cb8

Browse files
committed
check and set wal
1 parent d2b4176 commit 4613cb8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

mypy/metastore.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ def connect_db(db_file: str, sync_off: bool = False) -> sqlite3.Connection:
163163
# but without this flag, commits are *very* slow, especially when using HDDs,
164164
# see https://www.sqlite.org/faq.html#q19 for details.
165165
db.execute("PRAGMA synchronous=OFF")
166-
db.execute("PRAGMA journal_mode=WAL")
166+
167+
mode = db.execute("PRAGMA journal_mode").fetchone()[0]
168+
if mode.lower() != "wal":
169+
mode = db.execute("PRAGMA journal_mode=WAL").fetchone()[0]
170+
167171
db.executescript(SCHEMA)
168172
return db
169173

0 commit comments

Comments
 (0)