mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
work around existing instance not responding quickly
on a slow computer the first instance may have set up the local server but not yet started the main loop, so when a user double clicks on the icon twice, the second instance was timing out and opening another window, then giving locked database errors to work around this, increase the timeout, and tell the user the existing instance is not responding instead of creating a new instance https://anki.tenderapp.com/discussions/ankidesktop/30306-error https://anki.tenderapp.com/discussions/ankidesktop/30550-im-sorry
This commit is contained in:
parent
2483e9c89e
commit
e18bd4d67d
1 changed files with 5 additions and 2 deletions
|
@ -157,7 +157,7 @@ class AnkiApp(QApplication):
|
|||
appMsg = pyqtSignal(str)
|
||||
|
||||
KEY = "anki"+checksum(getpass.getuser())
|
||||
TMOUT = 5000
|
||||
TMOUT = 30000
|
||||
|
||||
def __init__(self, argv):
|
||||
QApplication.__init__(self, argv)
|
||||
|
@ -191,7 +191,10 @@ class AnkiApp(QApplication):
|
|||
sock.write(txt.encode("utf8"))
|
||||
if not sock.waitForBytesWritten(self.TMOUT):
|
||||
# existing instance running but hung
|
||||
return False
|
||||
QMessageBox.warning(None, "Anki Already Running",
|
||||
"If the existing instance of Anki is not responding, please close it using your task manager, or restart your computer.")
|
||||
|
||||
sys.exit(1)
|
||||
sock.disconnectFromServer()
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in a new issue