Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

Commit

Permalink
Log warning when HTTP client timeout is too low (#428)
Browse files Browse the repository at this point in the history
* added warning log when http timeout is less than ilp expiry

Signed-off-by: nkramer44 <noah.ph.kramer@gmail.com>
  • Loading branch information
nkramer44 committed Feb 1, 2020
1 parent a161f29 commit 9a94323
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
Expand Down Expand Up @@ -120,6 +122,12 @@ public IlpOverHttpLink(
public InterledgerResponsePacket sendPacket(final InterledgerPreparePacket preparePacket) {
Objects.requireNonNull(preparePacket);

if (preparePacket.getExpiresAt() != null &&
okHttpClient.readTimeoutMillis() <= Duration.between(Instant.now(), preparePacket.getExpiresAt()).toMillis()) {
logger.warn("OkHttpClient read timeout is shorter than the Prepare Packet's timeout. " +
"This may result in an HTTP timeout while unexpired ILP packets are in flight.");
}

final Request okHttpRequest;
try {
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
Expand Down

0 comments on commit 9a94323

Please sign in to comment.