remove async updates (old functionality)

This commit is contained in:
StarAppeal
2025-09-20 23:10:14 +02:00
parent 6f7dc961f6
commit cd38892d65
5 changed files with 2 additions and 8 deletions
-1
View File
@@ -6,5 +6,4 @@ export interface ExtendedWebSocket extends WebSocket {
payload: DecodedToken;
isAlive: boolean;
user: IUser;
asyncUpdates: Map<string, NodeJS.Timeout>
}
+1 -1
View File
@@ -1,4 +1,4 @@
import axios, { AxiosError } from "axios";
import axios from "axios";
import {CurrentlyPlaying} from "../interfaces/CurrentlyPlaying";
export class SpotifyApiService {
+1 -4
View File
@@ -24,10 +24,7 @@ export class WebsocketEventHandler {
this.webSocket.onclose = (event) => {
console.log("WebSocket closed:", event.code, event.reason, event.wasClean, event.type);
console.log(`User: ${this.webSocket.payload.username} disconnected`);
for (const [key, value] of this.webSocket.asyncUpdates) {
console.log("Stopping Update:", key);
clearInterval(value);
}
callback();
};
}
@@ -29,7 +29,6 @@ export class WebsocketServerEventHandler {
// second: set the isAlive flag to true
ws.isAlive = true;
ws.asyncUpdates = new Map<string, NodeJS.Timeout>();
// last: call the callback function
callback(ws, request);
@@ -77,7 +77,6 @@ describe("WebsocketEventHandler", () => {
it("should handle disconnect with no async updates", () => {
const mockCallback = vi.fn();
mockWebSocket.asyncUpdates = new Map();
const clearIntervalSpy = vi.spyOn(global, "clearInterval");
websocketEventHandler.enableDisconnectEvent(mockCallback);