Compare commits

..

No commits in common. "01738a5f0adc66f4b9680e8811cc6e1a065cea43" and "ab51cfb0c525b1a99c15286748c5ad0531832d17" have entirely different histories.

5 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
package de.hhhammer.dchat.discord.ws;
public interface Retryer {
int nextRetryInSeconds();
public int nextRetryInSeconds();
boolean hasRetriesLeft();
public boolean hasRetriesLeft();
}

View file

@ -4,7 +4,9 @@ import de.hhhammer.dchat.discord.ws.Retryer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Duration;
import java.time.LocalTime;
import java.util.Timer;
import java.util.concurrent.atomic.AtomicInteger;
public final class BackoffRetryer implements Retryer {

View file

@ -1,6 +1,7 @@
package de.hhhammer.dchat.discord.ws.connection;
import de.hhhammer.dchat.discord.ws.Retryer;
import de.hhhammer.dchat.discord.ws.connection.event.CloseEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View file

@ -14,6 +14,7 @@ import java.net.http.WebSocket;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@ -116,8 +117,7 @@ public final class DiscordListener implements WebSocket.Listener {
case 4000, 4001, 4002, 4005, 4008 ->
this.closeEventQueue.add(new CloseEvent.ResumableCloseEvent(this.resumeGatewayUrl.get(), this.sessionId.get(), lastSeq.get()));
// 1000 and 1001 can be sent or received as close code and should trigger reconnect -> https://discord.com/developers/docs/events/gateway#initiating-a-disconnect
// 1006 unexpected error and comes without description - reconnect seems fine ->
case 1000, 1001, 1006, 4003, 4007, 4009 -> this.closeEventQueue.add(new CloseEvent.UnresumableCloseEvent());
case 0, 4003, 4007, 4009 -> this.closeEventQueue.add(new CloseEvent.UnresumableCloseEvent());
case 4004, 4010, 4011, 4012, 4013, 4014 ->
this.closeEventQueue.add(new CloseEvent.UnrecoverableCloseEvent());
default -> {

View file

@ -9,6 +9,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>de.hhhammer.dchat</groupId>
<artifactId>openai-rest</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>