20602: Allow lock requests to queue up to 2s (configurable).
[arvados.git] / lib / service / cmd.go
index f4d4ec8efe4b8878d97fafdfc70ba6e364f92689..854b94861f1362f9e58592f771400bed28b9afaa 100644 (file)
@@ -155,11 +155,12 @@ func (c *command) RunCommand(prog string, args []string, stdin io.Reader, stdout
                                        httpserver.LogRequests(
                                                interceptHealthReqs(cluster.ManagementToken, handler.CheckHealth,
                                                        &httpserver.RequestLimiter{
-                                                               Handler:       handler,
-                                                               MaxConcurrent: cluster.API.MaxConcurrentRequests,
-                                                               MaxQueue:      cluster.API.MaxQueuedRequests,
-                                                               Priority:      c.requestPriority,
-                                                               Registry:      reg}))))))
+                                                               Handler:                    handler,
+                                                               MaxConcurrent:              cluster.API.MaxConcurrentRequests,
+                                                               MaxQueue:                   cluster.API.MaxQueuedRequests,
+                                                               MaxQueueTimeForMinPriority: cluster.API.MaxQueueTimeForLockRequests.Duration(),
+                                                               Priority:                   c.requestPriority,
+                                                               Registry:                   reg}))))))
        srv := &httpserver.Server{
                Server: http.Server{
                        Handler:     ifCollectionInHost(instrumented, instrumented.ServeAPI(cluster.ManagementToken, instrumented)),
@@ -261,7 +262,7 @@ func (c *command) requestPriority(req *http.Request, queued time.Time) int64 {
                // Return 503 immediately instead of queueing. We want
                // to send feedback to dispatchcloud ASAP to stop
                // bringing up new containers.
-               return httpserver.IneligibleForQueuePriority
+               return httpserver.MinPriority
        case req.Method == http.MethodPost && strings.HasPrefix(req.URL.Path, "/arvados/v1/logs"):
                // "Create log entry" is the most harmless kind of
                // request to drop. Negative priority is called "low"