FroMage / redpipe

Redpipe Web Framework
Apache License 2.0
70 stars 10 forks source link

HelloResource example- webclient should be closed #10

Closed fiorenzino closed 6 years ago

fiorenzino commented 6 years ago

if i'm right, you should close the webclient after use:

private Single<String> get(Vertx vertx, URI uri) {
    WebClient client = WebClient.create(vertx);
    Single<HttpResponse<Buffer>> responseHandler =
            client.get(uri.getPort(), uri.getHost(), uri.getPath()).rxSend();

    return responseHandler.map(response -> response.body().toString())
            .doAfterTerminate(
                    () -> {
                        client.close();
                    }
            );
}
FroMage commented 6 years ago

that sounds correct, thanks.

FroMage commented 6 years ago

Fixed, thanks.