Skip to content

Commit

Permalink
Modificate the way of defining httpClient
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel-Dorta committed Sep 30, 2019
1 parent b4851b1 commit cc8976d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/fetchImage/fetchImage.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/Miguel-Dorta/surveillance-cameras/internal"
"github.com/Miguel-Dorta/surveillance-cameras/pkg/client"
"golang.org/x/sys/unix"
"net/http"
"os"
"os/signal"
"path/filepath"
Expand All @@ -28,7 +29,7 @@ func init() {
flag.BoolVar(&printVersion, "version", false, "Print version and exit")
flag.BoolVar(&printVersion, "V", false, "Print version and exit")

client.HttpClient.Timeout = time.Second
client.HttpClient = &http.Client{Timeout: time.Second}
}

func checkFlags() {
Expand Down
6 changes: 5 additions & 1 deletion cmd/fetchVideo/fetchVideo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/Miguel-Dorta/surveillance-cameras/pkg/client"
"github.com/Miguel-Dorta/surveillance-cameras/pkg/html"
"log"
"net/http"
"os"
"path/filepath"
"time"
Expand All @@ -33,7 +34,7 @@ func init() {
flag.BoolVar(&printVersion, "version", false, "Print version and exit")
flag.BoolVar(&printVersion, "V", false, "Print version and exit")

client.HttpClient.Timeout = time.Hour
client.HttpClient = &http.Client{Timeout: time.Second * 5}
}

func parseFlags() {
Expand All @@ -57,6 +58,9 @@ func main() {
if err != nil {
logErr.Fatalf("cannot get a list of all videos: %s", err)
}

client.HttpClient.Timeout = time.Hour

errFound := false
for _, link := range linkVideos {
parentPath, savingPath := getSavingPath(destination, camName, link.Text)
Expand Down
5 changes: 5 additions & 0 deletions cmd/rotateCamera/rotateCamera.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package main

func main() {
$END$
}

0 comments on commit cc8976d

Please sign in to comment.