Commit c0e54f9f authored by Addshore's avatar Addshore 🏄 Committed by Addshore
Browse files

Reduce gitlab repeating update request timeout

This can block for 20 seconds if there is no internet
connection, so set a much shorter timeout...
parent 4a1086c5
...@@ -20,7 +20,9 @@ package gitlab ...@@ -20,7 +20,9 @@ package gitlab
import ( import (
"errors" "errors"
"fmt" "fmt"
"net/http"
"runtime" "runtime"
"time"
gitlab "github.com/xanzy/go-gitlab" gitlab "github.com/xanzy/go-gitlab"
) )
...@@ -30,9 +32,16 @@ var os = runtime.GOOS ...@@ -30,9 +32,16 @@ var os = runtime.GOOS
var arch = runtime.GOARCH var arch = runtime.GOARCH
func wikimediaClient() *gitlab.Client { func wikimediaClient() *gitlab.Client {
httpClient := http.Client{
Timeout: 2 * time.Second,
}
git, err := gitlab.NewClient( git, err := gitlab.NewClient(
"", "",
gitlab.WithBaseURL(wikimediav4ApiURL), gitlab.WithBaseURL(wikimediav4ApiURL),
gitlab.WithoutRetries(),
gitlab.WithHTTPClient(
&httpClient,
),
) )
if err != nil { if err != nil {
panic(err) panic(err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment