Skip to content

Commit

Permalink
woops, move this to process function
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Nov 14, 2024
1 parent ed434c5 commit e8a16a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zipserver/slurp_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ func slurpHandler(w http.ResponseWriter, r *http.Request) error {
return err
}

if !slurpLockTable.tryLockKey(key) {
return fmt.Errorf("Key is currently being processed: %s", key)
}
defer slurpLockTable.releaseKey(key)

slurpURL, err := getParam(params, "url")
if err != nil {
return err
Expand All @@ -49,6 +44,11 @@ func slurpHandler(w http.ResponseWriter, r *http.Request) error {
}

process := func(ctx context.Context) error {
if !slurpLockTable.tryLockKey(key) {
return fmt.Errorf("Key is currently being processed: %s", key)
}
defer slurpLockTable.releaseKey(key)

getCtx, cancel := context.WithTimeout(ctx, time.Duration(globalConfig.FileGetTimeout))
defer cancel()

Expand Down

0 comments on commit e8a16a6

Please sign in to comment.