Skip to content

Commit

Permalink
Inverted invokeAndBlock to be inside loop to mitigate possibility of …
Browse files Browse the repository at this point in the history
…deadlock while generating screenshots for CSS compiler.
  • Loading branch information
shannah committed Nov 20, 2020
1 parent ceccd47 commit 8f847a4
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,18 +653,16 @@ public void run() {
web.setURL("http://localhost:"+webServer.getPort()+"/index.html");

});
CN.invokeAndBlock(new Runnable() {
public void run() {
long startTime = System.currentTimeMillis();
while (!screenshotsComplete && System.currentTimeMillis() - startTime < timeout) {
synchronized(screenshotsLock) {
try {
screenshotsLock.wait(timeout);
} catch (Exception ex){}
}
long startTime = System.currentTimeMillis();
while (!screenshotsComplete && System.currentTimeMillis() - startTime < timeout) {
CN.invokeAndBlock(new Runnable() {
public void run() {
Util.wait(screenshotsLock, 50);
}
}
});
});

}


if (!screenshotsComplete) {
throw new RuntimeException("Failed to create screenshots for HTML "+html+". Timeout reached. Likely there was a problem initializing the browser component.");
Expand Down

0 comments on commit 8f847a4

Please sign in to comment.