mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 06:37:12 -05:00
fail gracefully if db is locked on sync all
This commit is contained in:
parent
1204f977e5
commit
1eac9b52a5
1 changed files with 22 additions and 15 deletions
|
|
@ -107,22 +107,29 @@ class Sync(QThread):
|
|||
self.emit(SIGNAL("syncFinished"))
|
||||
|
||||
def syncDeck(self, deck=None):
|
||||
# multi-mode setup
|
||||
if deck:
|
||||
c = sqlite.connect(deck)
|
||||
(syncName, localMod, localSync) = c.execute(
|
||||
"select syncName, modified, lastSync from decks").fetchone()
|
||||
c.close()
|
||||
if not syncName:
|
||||
try:
|
||||
if deck:
|
||||
# multi-mode setup
|
||||
c = sqlite.connect(deck)
|
||||
(syncName, localMod, localSync) = c.execute(
|
||||
"select syncName, modified, lastSync from decks").fetchone()
|
||||
c.close()
|
||||
if not syncName:
|
||||
return
|
||||
path = deck
|
||||
else:
|
||||
syncName = self.parent.syncName
|
||||
path = self.parent.deckPath
|
||||
c = sqlite.connect(path)
|
||||
(localMod, localSync) = c.execute(
|
||||
"select modified, lastSync from decks").fetchone()
|
||||
c.close()
|
||||
except Exception, e:
|
||||
# we don't know which db library we're using, so do string match
|
||||
if "locked" in unicode(e):
|
||||
return
|
||||
path = deck
|
||||
else:
|
||||
syncName = self.parent.syncName
|
||||
path = self.parent.deckPath
|
||||
c = sqlite.connect(path)
|
||||
(localMod, localSync) = c.execute(
|
||||
"select modified, lastSync from decks").fetchone()
|
||||
c.close()
|
||||
# unknown error
|
||||
raise
|
||||
# ensure deck mods cached
|
||||
try:
|
||||
proxy = self.connect()
|
||||
|
|
|
|||
Loading…
Reference in a new issue