commit 88e1eca94919614511258864f1dec9ebc1b311d9 parent 1fe660143cc8bbf60a62aa5354b238477639ab86 Author: Simon Kornblith <simon@simonster.com> Date: Tue, 3 Jan 2012 17:55:52 -0500 Fix slow connector switching under certain circumstances Diffstat:
| M | chrome/content/zotero/xpcom/ipc.js | | | 8 | ++++++-- |
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/ipc.js b/chrome/content/zotero/xpcom/ipc.js @@ -272,9 +272,13 @@ Zotero.IPC = new function() { instancePipeOpen = true; } - var wroteToPipe = Zotero.IPC.safePipeWrite(pipe, msg+"\n"); + // Try to write to the pipe once a ms for 100 ms + var timeout = Date.now()+100, wroteToPipe; + do { + wroteToPipe = Zotero.IPC.safePipeWrite(pipe, msg+"\n"); + } while(Date.now() < timeout && !wroteToPipe); success = success || wroteToPipe; - defunct = !wroteToPipe + defunct = !wroteToPipe; } if(defunct) {