Fix some tests
This commit is contained in:
@@ -78,16 +78,25 @@ export class LocalAdapter extends AbstractAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
export class EmptyAdapter extends AbstractAdapter {
|
||||
export class MockAdapter extends AbstractAdapter {
|
||||
constructor(
|
||||
readonly url: string,
|
||||
readonly send: (message: ClientMessage) => void,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
get sockets() {
|
||||
return []
|
||||
}
|
||||
|
||||
get urls() {
|
||||
return []
|
||||
return [this.url]
|
||||
}
|
||||
|
||||
send(message: ClientMessage) {}
|
||||
receive = (message: RelayMessage) => {
|
||||
this.emit(AdapterEvent.Receive, message, this.url)
|
||||
}
|
||||
}
|
||||
|
||||
export type AdapterContext = {
|
||||
|
||||
@@ -205,9 +205,7 @@ export const socketPolicyReopenActive = (socket: Socket) => {
|
||||
|
||||
// If the socket closed and we have no error, reopen it but don't flap
|
||||
if (newStatus === SocketStatus.Closed && pending.size) {
|
||||
console.log("1")
|
||||
sleep(Math.max(0, 30_000 - (Date.now() - lastOpen))).then(() => {
|
||||
console.log("2")
|
||||
for (const message of pending.values()) {
|
||||
socket.send(message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user