Skip to content

Commit 87d34b3

Browse files
authored
server : fix LRU check (#14079)
ggml-ci
1 parent b460d16 commit 87d34b3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/server/server.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,15 +2142,16 @@ struct server_context {
21422142

21432143
// find the slot that has been least recently used
21442144
if (ret == nullptr) {
2145-
int64_t t_last = ggml_time_us();
2145+
int64_t t_last = -1;
2146+
21462147
for (server_slot & slot : slots) {
21472148
// skip the slot if it is not available
21482149
if (slot.is_processing()) {
21492150
continue;
21502151
}
21512152

21522153
// select the current slot if the criteria match
2153-
if (slot.t_last_used < t_last) {
2154+
if (!ret || slot.t_last_used <= t_last) {
21542155
t_last = slot.t_last_used;
21552156
ret = &slot;
21562157
}

0 commit comments

Comments
 (0)