Commit 416c313e authored by nanahira's avatar nanahira

windbot is expect to join with timeout 500ms

parent efb8690d
Pipeline #43316 failed with stages
in 37 seconds
...@@ -122,7 +122,10 @@ export class ClientHandler { ...@@ -122,7 +122,10 @@ export class ClientHandler {
take(1), take(1),
takeUntil(client.disconnect$), takeUntil(client.disconnect$),
), ),
]).pipe(timeout(5000), takeUntil(client.disconnect$)); ]).pipe(
timeout(client.expectHandshakeTimeout()),
takeUntil(client.disconnect$),
);
return firstValueFrom(handshake$) return firstValueFrom(handshake$)
.then(() => { .then(() => {
......
...@@ -259,4 +259,8 @@ export class Client { ...@@ -259,4 +259,8 @@ export class Client {
(this.deck ? PlayerChangeState.READY : PlayerChangeState.NOTREADY), (this.deck ? PlayerChangeState.READY : PlayerChangeState.NOTREADY),
}); });
} }
expectHandshakeTimeout() {
return 5000;
}
} }
...@@ -74,4 +74,8 @@ export class ReverseWsClient extends Client { ...@@ -74,4 +74,8 @@ export class ReverseWsClient extends Client {
xffIp(): string | undefined { xffIp(): string | undefined {
return undefined; return undefined;
} }
expectHandshakeTimeout() {
return 500;
}
} }
...@@ -311,7 +311,7 @@ export class WindBotProvider { ...@@ -311,7 +311,7 @@ export class WindBotProvider {
url: URL, url: URL,
retryCount = 0, retryCount = 0,
): Promise<boolean> { ): Promise<boolean> {
const retryLimit = 3; const retryLimit = 10;
const retry = async () => { const retry = async () => {
// wait 200 ms // wait 200 ms
await new Promise((resolve) => setTimeout(resolve, 200)); await new Promise((resolve) => setTimeout(resolve, 200));
......
...@@ -960,6 +960,9 @@ export class Room { ...@@ -960,6 +960,9 @@ export class Room {
} }
async sendChat(msg: string, type: number = ChatColor.BABYBLUE) { async sendChat(msg: string, type: number = ChatColor.BABYBLUE) {
if (this.finalizing) {
return;
}
return Promise.all(this.allPlayers.map((p) => p.sendChat(msg, type))); return Promise.all(this.allPlayers.map((p) => p.sendChat(msg, type)));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment