fix(api): fix snapshot hanging

pull/2543/head
Anthony Lapenna 2018-12-12 17:00:15 +13:00
parent 6c26cf1f39
commit 1384359baf
2 changed files with 36 additions and 32 deletions

View File

@ -45,6 +45,7 @@ func (runner *SnapshotJobRunner) GetSchedule() *portainer.Schedule {
// As a snapshot can be a long process, to avoid any concurrency issue we
// retrieve the latest version of the endpoint right after a snapshot.
func (runner *SnapshotJobRunner) Run() {
go func() {
endpoints, err := runner.context.endpointService.Endpoints()
if err != nil {
log.Printf("background schedule error (endpoint snapshot). Unable to retrieve endpoint list (err=%s)\n", err)
@ -80,4 +81,5 @@ func (runner *SnapshotJobRunner) Run() {
return
}
}
}()
}

View File

@ -3,6 +3,7 @@ package docker
import (
"net/http"
"strings"
"time"
"github.com/docker/docker/client"
"github.com/portainer/portainer"
@ -102,5 +103,6 @@ func httpClient(endpoint *portainer.Endpoint) (*http.Client, error) {
return &http.Client{
Transport: transport,
Timeout: 30 * time.Second,
}, nil
}