mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-16 09:36:18 +02:00
fix typo
This commit is contained in:
committed by
Sergey Alexandrovich
parent
07528dbecf
commit
16571e1360
@@ -208,7 +208,7 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
if queueSem != nil {
|
||||
token, aquired := queueSem.TryAquire()
|
||||
token, aquired := queueSem.TryAcquire()
|
||||
if !aquired {
|
||||
panic(ierrors.New(429, "Too many requests", "Too many requests"))
|
||||
}
|
||||
@@ -282,17 +282,17 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
// The heavy part start here, so we need to restrict workers number
|
||||
// The heavy part start here, so we need to restrict worker number
|
||||
var processingSemToken *semaphore.Token
|
||||
func() {
|
||||
defer metrics.StartQueueSegment(ctx)()
|
||||
|
||||
var aquired bool
|
||||
processingSemToken, aquired = processingSem.Aquire(ctx)
|
||||
if !aquired {
|
||||
var acquired bool
|
||||
processingSemToken, acquired = processingSem.Acquire(ctx)
|
||||
if !acquired {
|
||||
// We don't actually need to check timeout here,
|
||||
// but it's an easy way to check if this is an actual timeout
|
||||
// or the request was cancelled
|
||||
// or the request was canceled
|
||||
checkErr(ctx, "queue", router.CheckTimeout(ctx))
|
||||
}
|
||||
}()
|
||||
|
@@ -15,7 +15,7 @@ func New(n int) *Semaphore {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Semaphore) Aquire(ctx context.Context) (*Token, bool) {
|
||||
func (s *Semaphore) Acquire(ctx context.Context) (*Token, bool) {
|
||||
select {
|
||||
case s.sem <- struct{}{}:
|
||||
return &Token{release: s.release}, true
|
||||
@@ -24,7 +24,7 @@ func (s *Semaphore) Aquire(ctx context.Context) (*Token, bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Semaphore) TryAquire() (*Token, bool) {
|
||||
func (s *Semaphore) TryAcquire() (*Token, bool) {
|
||||
select {
|
||||
case s.sem <- struct{}{}:
|
||||
return &Token{release: s.release}, true
|
||||
|
Reference in New Issue
Block a user