Compare commits
2 commits
ab51cfb0c5
...
01738a5f0a
Author | SHA1 | Date | |
---|---|---|---|
01738a5f0a | |||
5c16c60782 |
5 changed files with 4 additions and 8 deletions
|
@ -1,7 +1,7 @@
|
|||
package de.hhhammer.dchat.discord.ws;
|
||||
|
||||
public interface Retryer {
|
||||
public int nextRetryInSeconds();
|
||||
int nextRetryInSeconds();
|
||||
|
||||
public boolean hasRetriesLeft();
|
||||
boolean hasRetriesLeft();
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ 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 {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ 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;
|
||||
|
@ -117,7 +116,8 @@ 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
|
||||
case 0, 4003, 4007, 4009 -> this.closeEventQueue.add(new CloseEvent.UnresumableCloseEvent());
|
||||
// 1006 unexpected error and comes without description - reconnect seems fine ->
|
||||
case 1000, 1001, 1006, 4003, 4007, 4009 -> this.closeEventQueue.add(new CloseEvent.UnresumableCloseEvent());
|
||||
case 4004, 4010, 4011, 4012, 4013, 4014 ->
|
||||
this.closeEventQueue.add(new CloseEvent.UnrecoverableCloseEvent());
|
||||
default -> {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>de.hhhammer.dchat</groupId>
|
||||
<artifactId>openai-rest</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
|
Loading…
Reference in a new issue