mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
remove queue resetting from startup; we'll do it in deck close instead
This commit is contained in:
parent
2613143fe9
commit
abd665e48f
1 changed files with 5 additions and 12 deletions
17
anki/deck.py
17
anki/deck.py
|
@ -2769,8 +2769,7 @@ class DeckStorage(object):
|
||||||
path = "sqlite:///" + path.encode("utf-8")
|
path = "sqlite:///" + path.encode("utf-8")
|
||||||
if pool:
|
if pool:
|
||||||
# open and lock connection for single use
|
# open and lock connection for single use
|
||||||
engine = create_engine(
|
engine = create_engine(path, connect_args={'timeout': 0})
|
||||||
path, connect_args={'timeout': 0}, strategy="threadlocal")
|
|
||||||
else:
|
else:
|
||||||
# no pool & concurrent access w/ timeout
|
# no pool & concurrent access w/ timeout
|
||||||
engine = create_engine(
|
engine = create_engine(
|
||||||
|
@ -2795,23 +2794,17 @@ class DeckStorage(object):
|
||||||
return deck
|
return deck
|
||||||
_init = staticmethod(_init)
|
_init = staticmethod(_init)
|
||||||
|
|
||||||
def Deck(path, backup=True, pool=True, rebuild=True):
|
def Deck(path, backup=True, pool=True, minimal=False):
|
||||||
"Create a new deck or attach to an existing one. Path should be unicode."
|
"Create a new deck or attach to an existing one. Path should be unicode."
|
||||||
path = os.path.abspath(path)
|
path = os.path.abspath(path)
|
||||||
create = not os.path.exists(path)
|
create = not os.path.exists(path)
|
||||||
deck = DeckStorage._getDeck(path, create, pool)
|
deck = DeckStorage._getDeck(path, create, pool)
|
||||||
deck.limits = simplejson.loads(deck._limits)
|
|
||||||
if not rebuild:
|
|
||||||
# minimal startup
|
|
||||||
return deck
|
|
||||||
oldMod = deck.modified
|
oldMod = deck.modified
|
||||||
# setup config
|
deck.limits = simplejson.loads(deck._limits)
|
||||||
deck.config = simplejson.loads(deck._config)
|
deck.config = simplejson.loads(deck._config)
|
||||||
deck.data = simplejson.loads(deck._data)
|
deck.data = simplejson.loads(deck._data)
|
||||||
# unsuspend buried/rev early
|
if minimal:
|
||||||
deck.db.statement(
|
return deck
|
||||||
"update cards set queue = type where queue between -3 and -2")
|
|
||||||
deck.db.commit()
|
|
||||||
# check if deck has been moved, and disable syncing
|
# check if deck has been moved, and disable syncing
|
||||||
deck.checkSyncHash()
|
deck.checkSyncHash()
|
||||||
# rebuild queue
|
# rebuild queue
|
||||||
|
|
Loading…
Reference in a new issue