From e18bd4d67dd31842040aa834b6de2663c298b5a5 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sun, 28 Oct 2018 14:17:16 +1000 Subject: [PATCH] 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 --- aqt/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aqt/__init__.py b/aqt/__init__.py index 537047e48..88e5e9e6f 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -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