Fix slow connector switching under certain circumstances

This commit is contained in:
Simon Kornblith 2012-01-03 17:55:52 -05:00
parent 1fe660143c
commit 88e1eca949

View File

@ -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) {