Code review comment: I did, but I misinterpreted it. No worries though, I'll update the PR tomorrow to set the timeout extremely high, thus preserving the essence of what this change attempts.

Code before review:
public void nextEvent(RoutingContext ctx) {
vertx.executeBlocking(new Handler<>() {
@Override
public void handle(Promise<Object> event) {
final AtomicBoolean closed = new AtomicBoolean(false);
ctx.response().closeHandler((v) -> closed.set(true));
ctx.response().exceptionHandler((v) -> closed.set(true));
ctx.request().connection().closeHandler((v) -> closed.set(true));
ctx.request().connection().exceptionHandler((v) -> closed.set(true));
RoutingContext request = null;
try {
for (;;) {
request = queue.poll(10, TimeUnit.MILLISECONDS);
if (request != null) {
if (closed.get()) {
log.debugf("Polled message %s but connection was closed, returning to queue",
request.get(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID));
queue.put(request);
return;
} else {
break;
}
} else if (closed.get()) {
return;
}
}
} catch (InterruptedException e) {
log.error("nextEvent interrupted");
ctx.fail(500);
}
String contentType = getEventContentType(request);
if (contentType != null) {
ctx.response().putHeader("content-type", contentType);
}
String traceId = request.get(AmazonLambdaApi.LAMBDA_TRACE_HEADER_KEY);
if (traceId != null) {
ctx.response().putHeader(AmazonLambdaApi.LAMBDA_TRACE_HEADER_KEY, traceId);
}
String requestId = request.get(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID);
log.debugf("Starting processing %s, added to pending request map", requestId);
responsePending.put(requestId, request);
ctx.response().putHeader(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID, requestId);
Buffer body = processEventBody(request);
if (body != null) {
ctx.response().setStatusCode(200).end(body);
} else {
ctx.response().setStatusCode(200).end();
}
}
}, false, null);
}

Line under review: @Override

Code after addressing the review:
public void nextEvent(RoutingContext ctx) {
vertx.executeBlocking(new Handler<>() {
@Override
public void handle(Promise<Object> event) {
final AtomicBoolean closed = new AtomicBoolean(false);
ctx.response().closeHandler((v) -> closed.set(true));
ctx.response().exceptionHandler((v) -> closed.set(true));
ctx.request().connection().closeHandler((v) -> closed.set(true));
ctx.request().connection().exceptionHandler((v) -> closed.set(true));
RoutingContext request = null;
try {
for (;;) {
request = queue.poll(10, TimeUnit.MILLISECONDS);
if (request != null) {
if (closed.get()) {
log.debugf("Polled message %s but connection was closed, returning to queue",
request.get(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID));
queue.put(request);
return;
} else {
break;
}
} else if (closed.get()) {
return;
}
}
} catch (InterruptedException e) {
log.error("nextEvent interrupted");
ctx.fail(500);
}
String contentType = getEventContentType(request);
if (contentType != null) {
ctx.response().putHeader("content-type", contentType);
}
String traceId = request.get(AmazonLambdaApi.LAMBDA_TRACE_HEADER_KEY);
if (traceId != null) {
ctx.response().putHeader(AmazonLambdaApi.LAMBDA_TRACE_HEADER_KEY, traceId);
}
String requestId = request.get(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID);
log.debugf("Starting processing %s, added to pending request map", requestId);
responsePending.put(requestId, request);
ctx.response().putHeader(AmazonLambdaApi.LAMBDA_RUNTIME_AWS_REQUEST_ID, requestId);
Buffer body = processEventBody(request);
if (body != null) {
ctx.response().setStatusCode(200).end(body);
} else {
ctx.response().setStatusCode(200).end();
}
}
}, false, null);
}