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,8 +107,9 @@ 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:
|
||||||
|
# multi-mode setup
|
||||||
c = sqlite.connect(deck)
|
c = sqlite.connect(deck)
|
||||||
(syncName, localMod, localSync) = c.execute(
|
(syncName, localMod, localSync) = c.execute(
|
||||||
"select syncName, modified, lastSync from decks").fetchone()
|
"select syncName, modified, lastSync from decks").fetchone()
|
||||||
|
|
@ -123,6 +124,12 @@ class Sync(QThread):
|
||||||
(localMod, localSync) = c.execute(
|
(localMod, localSync) = c.execute(
|
||||||
"select modified, lastSync from decks").fetchone()
|
"select modified, lastSync from decks").fetchone()
|
||||||
c.close()
|
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
|
||||||
|
# unknown error
|
||||||
|
raise
|
||||||
# ensure deck mods cached
|
# ensure deck mods cached
|
||||||
try:
|
try:
|
||||||
proxy = self.connect()
|
proxy = self.connect()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue