mirror of https://github.com/portainer/portainer
fix(api): fix snapshot hanging
parent
6c26cf1f39
commit
1384359baf
|
@ -45,6 +45,7 @@ func (runner *SnapshotJobRunner) GetSchedule() *portainer.Schedule {
|
||||||
// As a snapshot can be a long process, to avoid any concurrency issue we
|
// 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.
|
// retrieve the latest version of the endpoint right after a snapshot.
|
||||||
func (runner *SnapshotJobRunner) Run() {
|
func (runner *SnapshotJobRunner) Run() {
|
||||||
|
go func() {
|
||||||
endpoints, err := runner.context.endpointService.Endpoints()
|
endpoints, err := runner.context.endpointService.Endpoints()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("background schedule error (endpoint snapshot). Unable to retrieve endpoint list (err=%s)\n", err)
|
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
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package docker
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/client"
|
"github.com/docker/docker/client"
|
||||||
"github.com/portainer/portainer"
|
"github.com/portainer/portainer"
|
||||||
|
@ -102,5 +103,6 @@ func httpClient(endpoint *portainer.Endpoint) (*http.Client, error) {
|
||||||
|
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: transport,
|
Transport: transport,
|
||||||
|
Timeout: 30 * time.Second,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue