{"record":{"id":"a920311321bec943","repo":"v2rayA/v2rayA","slug":"the-last-request-is-being-processed","errorCode":null,"errorMessage":"the last request is being processed","messagePattern":"the last request is being processed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"service/server/controller/controller.go","lineNumber":11,"sourceCode":"package controller\n\nimport (\n\t\"fmt\"\n\t\"sync\"\n)\n\nvar (\n\tupdating      bool\n\tupdatingMu    sync.Mutex\n\tprocessingErr = fmt.Errorf(\"the last request is being processed\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":13,"githubUrl":"https://github.com/v2rayA/v2rayA/blob/71e5442fc548c05680ee55eae943e6c0afe9ac51/service/server/controller/controller.go#L1-L13","documentation":"processingErr is a package-level sentinel returned when a mutating connection/v2ray/latency request arrives while the single-flight `updating` flag is held by a previous request. The controller serializes these handlers with updatingMu; concurrent requests are rejected immediately instead of queueing. It is an intentional back-pressure signal, not a fault.","triggerScenarios":"Any of PostConnection, DeleteConnection, PostV2ray, DeleteV2ray, GetPingLatency, GetHttpLatency called while another of those handlers is still running (updating==true) — e.g. double-clicking connect, or parallel latency tests issued with a connect request.","commonSituations":"UI sending duplicate requests on rapid clicks; scripts polling connect while a restart is in flight; load balancer retrying a slow request that is still being processed.","solutions":["Serialize requests client-side: wait for the in-flight response before sending another mutating request","Add retry with backoff on this response and re-check state via GET touch endpoints","Debounce UI buttons and disable them until the response arrives"],"exampleFix":"// before: parallel fire-and-forget\nfor i:=0;i<3;i++ { go post(\"/api/v2ray\") } // two may hit processingErr\n// after: sequential with retry\nif err := post(\"/api/v2ray\"); isProcessing(err) { time.Sleep(500*time.Millisecond); post(\"/api/v2ray\") }","handlingStrategy":"retry","validationCode":"// client-side: track in-flight request\nif inflight { await(inflightPromise) } // do not fire a second mutating call","typeGuard":null,"tryCatchPattern":"resp := post(path); if resp.Message == \"the last request is being processed\" { sleep(backoff); retry(maxAttempts=3) }","preventionTips":["Debounce/disable buttons while a request is in flight","Serialize mutating calls through a single queue","Treat this response as retryable back-pressure"],"tags":["concurrency","rate-limit","backpressure","go"],"backgroundTag":"request-already-processing","analyzedSha":"71e5442fc548c05680ee55eae943e6c0afe9ac51","analyzedAt":"2026-09-05T20:04:37.459Z","contentChangedAt":"2026-09-05T20:04:37.459Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}