bug: load more fix

This commit is contained in:
2023-03-28 16:41:57 +01:00
parent 465c59ea20
commit 2ccf593476
7 changed files with 71 additions and 39 deletions

View File

@ -60,6 +60,7 @@ export class Connection {
Authed: boolean;
Ephemeral: boolean;
EphemeralTimeout: ReturnType<typeof setTimeout> | undefined;
Down = true;
constructor(addr: string, options: RelaySettings, auth?: AuthHandler, ephemeral: boolean = false) {
this.Id = uuid();
@ -143,6 +144,7 @@ export class Connection {
OnOpen() {
this.ConnectTimeout = DefaultConnectTimeout;
console.log(`[${this.Address}] Open!`);
this.Down = false;
this.OnConnected?.();
}
@ -300,6 +302,7 @@ export class Connection {
CloseReq(id: string) {
if (this.ActiveRequests.delete(id)) {
this.#SendJson(["CLOSE", id]);
this.OnEose?.(id);
this.#SendQueuedRequests();
}
}
@ -319,6 +322,10 @@ export class Connection {
}
#ResetQueues() {
//send EOSE on disconnect for active subs
this.ActiveRequests.forEach(v => this.OnEose?.(v))
this.PendingRequests.forEach(v => this.OnEose?.(v[1]));
this.ActiveRequests.clear();
this.PendingRequests = [];
this.PendingRaw = [];