Skip to content

Commit

Permalink
Revert "Add download timeout (set to 20 seconds)"
Browse files Browse the repository at this point in the history
Commit abe6bf6 introduced a download
timeout that is hardcoded to 20s. This timeout is not enough fo many
people. Revert the commit until better solution is found.

Closes anatol#19
  • Loading branch information
anatol committed Sep 8, 2020
1 parent 6ac0efc commit 553fdbf
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pacoloco.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"flag"
"fmt"
"io"
Expand Down Expand Up @@ -154,9 +153,7 @@ func handleRequest(w http.ResponseWriter, req *http.Request) error {
// file and sends to `clientWriter` at the same time.
// The function returns whether the function sent the data to client and error if one occurred
func downloadFile(url string, filePath string, ifModifiedSince time.Time, clientWriter http.ResponseWriter) (err error, served bool) {
ctx, ctxCancel := context.WithTimeout(context.Background(), 20*time.Second)
defer ctxCancel()
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return
}
Expand Down

0 comments on commit 553fdbf

Please sign in to comment.