Fix realtime queued task counts
This commit is contained in:
@@ -783,6 +783,24 @@ WHERE reference_type = 'gateway_task'
|
||||
if len(asyncRateLimitDetail.Attempts) != 0 {
|
||||
t.Fatalf("async rate-limited task should wait in queue without recording a failed attempt: %+v", asyncRateLimitDetail)
|
||||
}
|
||||
var modelRateLimits struct {
|
||||
Items []struct {
|
||||
ModelName string `json:"modelName"`
|
||||
ModelAlias string `json:"modelAlias"`
|
||||
QueuedTasks float64 `json:"queuedTasks"`
|
||||
} `json:"items"`
|
||||
}
|
||||
doJSON(t, server.URL, http.MethodGet, "/api/admin/runtime/model-rate-limits", loginResponse.AccessToken, nil, http.StatusOK, &modelRateLimits)
|
||||
var queuedTasks float64
|
||||
for _, item := range modelRateLimits.Items {
|
||||
if item.ModelName == rateLimitedModel || item.ModelAlias == rateLimitedModel {
|
||||
queuedTasks = item.QueuedTasks
|
||||
break
|
||||
}
|
||||
}
|
||||
if queuedTasks < 1 {
|
||||
t.Fatalf("realtime load should count async rate-limited task as queued, got %v in %+v", queuedTasks, modelRateLimits.Items)
|
||||
}
|
||||
asyncRateLimitCompleted := waitForTaskStatus(t, server.URL, apiKeyResponse.Secret, asyncRateLimitTask.TaskID, []string{"succeeded"}, time.Duration(rateLimitWindowSeconds+3)*time.Second)
|
||||
if asyncRateLimitCompleted.Status != "succeeded" {
|
||||
t.Fatalf("async rate-limited task should be pulled from queue after the limit window resets, got %+v", asyncRateLimitCompleted)
|
||||
|
||||
Reference in New Issue
Block a user