Skip to content

Commit aa11072

Browse files
fix: removed the slots availability throttle constant and state
1 parent e1a3b01 commit aa11072

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

tools/server/webui/src/lib/stores/server.svelte.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { SERVER_PROPS_LOCALSTORAGE_KEY } from '$lib/constants/localstorage-keys'
33
import { ChatService } from '$lib/services/chat';
44
import { config } from '$lib/stores/settings.svelte';
55

6-
const SLOTS_CHECK_THROTTLE_MS = 30_000;
7-
86
/**
97
* ServerStore - Server state management and capability detection
108
*
@@ -55,7 +53,6 @@ class ServerStore {
5553
private _serverWarning = $state<string | null>(null);
5654
private _slotsEndpointAvailable = $state<boolean | null>(null);
5755
private fetchServerPropsPromise: Promise<void> | null = null;
58-
private lastSlotsCheck = 0;
5956

6057
private readCachedServerProps(): ApiLlamaCppServerProps | null {
6158
if (!browser) return null;
@@ -138,15 +135,7 @@ class ServerStore {
138135
/**
139136
* Check if slots endpoint is available based on server properties and endpoint support
140137
*/
141-
private async checkSlotsEndpointAvailability(force = false): Promise<void> {
142-
const now = Date.now();
143-
144-
if (!force && this.lastSlotsCheck && now - this.lastSlotsCheck < SLOTS_CHECK_THROTTLE_MS) {
145-
return;
146-
}
147-
148-
this.lastSlotsCheck = now;
149-
138+
private async checkSlotsEndpointAvailability(): Promise<void> {
150139
if (!this._serverProps) {
151140
this._slotsEndpointAvailable = false;
152141
return;
@@ -211,8 +200,7 @@ class ServerStore {
211200
this.persistServerProps(props);
212201
this._error = null;
213202
this._serverWarning = null;
214-
this.lastSlotsCheck = 0;
215-
await this.checkSlotsEndpointAvailability(true);
203+
await this.checkSlotsEndpointAvailability();
216204
} catch (error) {
217205
if (isSilent && hadProps) {
218206
console.warn('Silent server props refresh failed, keeping cached data:', error);
@@ -327,7 +315,6 @@ class ServerStore {
327315
this._loading = false;
328316
this._slotsEndpointAvailable = null;
329317
this.fetchServerPropsPromise = null;
330-
this.lastSlotsCheck = 0;
331318
this.persistServerProps(null);
332319
}
333320
}

0 commit comments

Comments
 (0)