Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not lose exception in bloop connection check #552

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object BloopServer {
bloopVersion,
bloopJava
)
Await.result(fut, 30.seconds)
Await.result(fut, config.startCheckTimeout + 30.seconds)
}
def exitBloop() = BloopRifle.exit(config, workdir, logger)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,29 @@ object Operations {
def check0(f: => ScheduledFuture[_]): Runnable = {
val start = System.currentTimeMillis()
() =>
val completionOpt =
if (!p.isAlive())
Some(Failure(new Exception("Server didn't start")))
else if (check(address, logger))
Some(Success(()))
else if (timeout.isFinite && System.currentTimeMillis() - start > timeout.toMillis)
Some(Failure(new Exception(s"Server didn't start after $timeout ms")))
else
None

for (completion <- completionOpt) {
promise.tryComplete(completion)
f.cancel(false)
try {
val completionOpt =
if (!p.isAlive())
Some(Failure(new Exception("Server didn't start")))
else if (check(address, logger))
Some(Success(()))
else if (timeout.isFinite && System.currentTimeMillis() - start > timeout.toMillis)
Some(Failure(new Exception(s"Server didn't start after $timeout ms")))
else
None

for (completion <- completionOpt) {
promise.tryComplete(completion)
f.cancel(false)
}
}
catch {
case t: Throwable =>
if (timeout.isFinite && System.currentTimeMillis() - start > timeout.toMillis) {
promise.tryFailure(t)
f.cancel(false)
}
throw t
}
}

Expand Down