mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 14:47: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"))
|
self.emit(SIGNAL("syncFinished"))
|
||||||
|
|
||||||
def syncDeck(self, deck=None):
|
def syncDeck(self, deck=None):
|
||||||
# multi-mode setup
|
try:
|
||||||
if deck:
|
if deck:
|
||||||
c = sqlite.connect(deck)
|
# multi-mode setup
|
||||||
(syncName, localMod, localSync) = c.execute(
|
c = sqlite.connect(deck)
|
||||||
"select syncName, modified, lastSync from decks").fetchone()
|
(syncName, localMod, localSync) = c.execute(
|
||||||
c.close()
|
"select syncName, modified, lastSync from decks").fetchone()
|
||||||
if not syncName:
|
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
|
return
|
||||||
path = deck
|
# unknown error
|
||||||
else:
|
raise
|
||||||
syncName = self.parent.syncName
|
|
||||||
path = self.parent.deckPath
|
|
||||||
c = sqlite.connect(path)
|
|
||||||
(localMod, localSync) = c.execute(
|
|
||||||
"select modified, lastSync from decks").fetchone()
|
|
||||||
c.close()
|
|
||||||
# ensure deck mods cached
|
# ensure deck mods cached
|
||||||
try:
|
try:
|
||||||
proxy = self.connect()
|
proxy = self.connect()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue