Skip to content

Commit

Permalink
Bump version and beautify
Browse files Browse the repository at this point in the history
  • Loading branch information
pbernet committed Jun 2, 2024
1 parent c0fcf10 commit 913e7d1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version := "1.0"
scalaVersion := "2.13.14"

val pekkoVersion = "1.1.0-M1"
val pekkoHTTPVersion = "1.0.1"
val pekkoHTTPVersion = "1.1.0-M1"
val pekkoConnectorVersion = "1.0.2"
val pekkoConnectorKafkaVersion = "1.0.0"

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/akkahttp/WebsocketChatEcho.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.collection.parallel.CollectionConverters.*
import scala.concurrent.Future
import scala.concurrent.duration.*
/**
* A simple WebSocket chat system using only akka streams with the help of MergeHub Source and BroadcastHub Sink
* A simple WebSocket chat system using only pekko streams with the help of MergeHub Source and BroadcastHub Sink
* See also: [[WebsocketEcho]]
*
* Initial version shamelessly stolen from:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.hc.core5.http.ClassicHttpResponse;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.io.HttpClientResponseHandler;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
Expand Down Expand Up @@ -113,7 +114,7 @@ public boolean retryRequest(HttpRequest request, IOException exception, int exec
@Override
public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) {
int httpStatusCode = response.getCode();
if (httpStatusCode != 503)
if (httpStatusCode != HttpStatus.SC_SERVICE_UNAVAILABLE)
return false; // retry only on HTTP 503

if (execCount >= maxRetriesCount) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/tools/HttpRequestRetryStrategyOpenAI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.apache.hc.client5.http.HttpRequestRetryStrategy;
import org.apache.hc.core5.http.HttpRequest;
import org.apache.hc.core5.http.HttpResponse;
import org.apache.hc.core5.http.HttpStatus;
import org.apache.hc.core5.http.protocol.HttpContext;
import org.apache.hc.core5.util.TimeValue;
import org.json.JSONObject;
Expand Down Expand Up @@ -67,7 +68,7 @@ public boolean retryRequest(HttpRequest request, IOException exception, int exec
@Override
public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) {
int httpStatusCode = response.getCode();
if (httpStatusCode == 500 || httpStatusCode == 503) {
if (httpStatusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR || httpStatusCode == HttpStatus.SC_SERVICE_UNAVAILABLE) {
if (execCount >= maxRetriesCount) {
LOGGER.warn("Request failed after: {} retries",
execCount);
Expand Down

0 comments on commit 913e7d1

Please sign in to comment.