Remove tsc-multi, re-install gts, apply autoformatting and linting

This commit is contained in:
Jon Staab
2024-12-17 10:59:27 -08:00
parent 0b86613161
commit f33e03740e
122 changed files with 2243 additions and 2178 deletions
+12 -12
View File
@@ -1,9 +1,9 @@
import {Worker} from '@welshman/lib'
import {AUTH_JOIN} from '@welshman/util'
import {SocketStatus} from './Socket'
import type {Message} from './Socket'
import type {Connection} from './Connection'
import {AuthStatus} from './ConnectionAuth'
import {Worker} from "@welshman/lib"
import {AUTH_JOIN} from "@welshman/util"
import {SocketStatus} from "./Socket.js"
import type {Message} from "./Socket.js"
import type {Connection} from "./Connection.js"
import {AuthStatus} from "./ConnectionAuth.js"
export class ConnectionSender {
worker: Worker<Message>
@@ -12,22 +12,22 @@ export class ConnectionSender {
this.worker = new Worker({
shouldDefer: ([verb, ...extra]: Message) => {
// Always send CLOSE to clean up pending requests, even if the connection is closed
if (verb === 'CLOSE') return false
if (verb === "CLOSE") return false
// If we're not connected, nothing we can do
if (cxn.socket.status !== SocketStatus.Open) return true
// Always allow sending AUTH
if (verb === 'AUTH') return false
if (verb === "AUTH") return false
// Always allow sending join requests
if (verb === 'EVENT' && extra[0].kind === AUTH_JOIN) return false
if (verb === "EVENT" && extra[0].kind === AUTH_JOIN) return false
// Wait for auth
if (![AuthStatus.None, AuthStatus.Ok].includes(cxn.auth.status)) return true
// Limit concurrent requests
if (verb === 'REQ') return cxn.state.pendingRequests.size >= 8
if (verb === "REQ") return cxn.state.pendingRequests.size >= 8
return false
},
@@ -35,8 +35,8 @@ export class ConnectionSender {
this.worker.addGlobalHandler(([verb, ...extra]: Message) => {
// If we ended up handling a CLOSE before we handled the REQ, don't send the REQ
if (verb === 'CLOSE') {
this.worker.buffer = this.worker.buffer.filter(m => !(m[0] === 'REQ' && m[1] === extra[0]))
if (verb === "CLOSE") {
this.worker.buffer = this.worker.buffer.filter(m => !(m[0] === "REQ" && m[1] === extra[0]))
}
// Re-check socket status since we let CLOSE through