bridge/gitlab: add gitlab client default timeout

Amine Hilaly created

bridge/gitlab: fix import bug

Change summary

bridge/gitlab/gitlab.go | 14 ++++++--------
bridge/gitlab/import.go |  2 +-
2 files changed, 7 insertions(+), 9 deletions(-)

Detailed changes

bridge/gitlab/gitlab.go 🔗

@@ -1,6 +1,7 @@
 package gitlab
 
 import (
+	"net/http"
 	"time"
 
 	"github.com/xanzy/go-gitlab"
@@ -9,9 +10,7 @@ import (
 )
 
 const (
-	target      = "gitlab"
-	gitlabV4Url = "https://gitlab.com/api/v4"
-
+	target         = "gitlab"
 	keyProjectID   = "project-id"
 	keyGitlabId    = "gitlab-id"
 	keyGitlabUrl   = "gitlab-url"
@@ -42,10 +41,9 @@ func (*Gitlab) NewExporter() core.Exporter {
 }
 
 func buildClient(token string) *gitlab.Client {
-	return gitlab.NewClient(nil, token)
-}
-
-func buildClientFromUsernameAndPassword(username, password string) (*gitlab.Client, error) {
-	return gitlab.NewBasicAuthClient(nil, "https://gitlab.com", username, password)
+	client := &http.Client{
+		Timeout: defaultTimeout,
+	}
 
+	return gitlab.NewClient(client, token)
 }

bridge/gitlab/import.go 🔗

@@ -120,7 +120,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue
 		return b, nil
 	}
 
-	return nil, nil
+	return b, nil
 }
 
 func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, note *gitlab.Note) error {