mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Ignore http 503 error from socket server
This commit is contained in:
parent
bc15e348f5
commit
0fe85ed6ff
@ -98,15 +98,24 @@ public class WebEditorSession {
|
|||||||
this.socket = socket;
|
this.socket = socket;
|
||||||
this.plugin.getWebEditorStore().sockets().putSocket(this.sender, this.socket);
|
this.plugin.getWebEditorStore().sockets().putSocket(this.sender, this.socket);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof UnsuccessfulRequestException && ((UnsuccessfulRequestException) e).getResponse().code() == 502) {
|
if (!ignoreSocketConnectError(e)) {
|
||||||
// 502 - bad gateway, probably means the socket service is offline
|
|
||||||
// that's ok, no need to send a warning
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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() {
|
private void createInitialSession() {
|
||||||
Objects.requireNonNull(this.initialRequest);
|
Objects.requireNonNull(this.initialRequest);
|
||||||
|
Loading…
Reference in New Issue
Block a user