mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47:12 -05:00
add async flag
This commit is contained in:
parent
ba0f6f36cc
commit
00becd01eb
1 changed files with 6 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ from anki.collection import _Collection
|
|||
from anki.consts import *
|
||||
from anki.stdmodels import addBasicModel, addClozeModel
|
||||
|
||||
def Collection(path, lock=True, server=False):
|
||||
def Collection(path, lock=True, server=False, sync=True):
|
||||
"Open a new or existing collection. Path must be unicode."
|
||||
assert path.endswith(".anki2")
|
||||
path = os.path.abspath(path)
|
||||
|
|
@ -26,8 +26,11 @@ def Collection(path, lock=True, server=False):
|
|||
else:
|
||||
ver = _upgradeSchema(db)
|
||||
db.execute("pragma temp_store = memory")
|
||||
if sync:
|
||||
db.execute("pragma cache_size = 10000")
|
||||
db.execute("pragma journal_mode = wal")
|
||||
else:
|
||||
db.execute("pragma synchronous = off")
|
||||
# add db to col and do any remaining upgrades
|
||||
col = _Collection(db, server)
|
||||
if ver < SCHEMA_VERSION:
|
||||
|
|
|
|||
Loading…
Reference in a new issue