mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-24 11:38:40 +01:00
Ignore http 503 error from socket server
This commit is contained in:
parent
bc15e348f5
commit
0fe85ed6ff
@ -98,16 +98,25 @@ public class WebEditorSession {
|
||||
this.socket = socket;
|
||||
this.plugin.getWebEditorStore().sockets().putSocket(this.sender, this.socket);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof UnsuccessfulRequestException && ((UnsuccessfulRequestException) e).getResponse().code() == 502) {
|
||||
// 502 - bad gateway, probably means the socket service is offline
|
||||
// that's ok, no need to send a warning
|
||||
return;
|
||||
if (!ignoreSocketConnectError(e)) {
|
||||
this.plugin.getLogger().warn("Unable to establish socket connection", e);
|
||||
}
|
||||
|
||||
this.plugin.getLogger().warn("Unable to establish socket connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean ignoreSocketConnectError(Exception e) {
|
||||
if (e instanceof UnsuccessfulRequestException) {
|
||||
UnsuccessfulRequestException req = (UnsuccessfulRequestException) e;
|
||||
int code = req.getResponse().code();
|
||||
|
||||
// 502 - bad gateway / 503 - service unavailable
|
||||
// probably means the socket service is offline, that's ok, no need to send a warning
|
||||
return code == 502 || code == 503;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void createInitialSession() {
|
||||
Objects.requireNonNull(this.initialRequest);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user