mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(plugins): increase timeout
This commit is contained in:
parent
e5c64732f1
commit
99c77e7df8
@ -32,11 +32,25 @@ func New(logger string, ctx ...interface{}) Logger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Trace(format string, v ...interface{}) {
|
func Trace(format string, v ...interface{}) {
|
||||||
Root.Debug(fmt.Sprintf(format, v))
|
var message string
|
||||||
|
if len(v) > 0 {
|
||||||
|
message = fmt.Sprintf(format, v)
|
||||||
|
} else {
|
||||||
|
message = format
|
||||||
|
}
|
||||||
|
|
||||||
|
Root.Debug(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Debug(format string, v ...interface{}) {
|
func Debug(format string, v ...interface{}) {
|
||||||
Root.Debug(fmt.Sprintf(format, v))
|
var message string
|
||||||
|
if len(v) > 0 {
|
||||||
|
message = fmt.Sprintf(format, v)
|
||||||
|
} else {
|
||||||
|
message = format
|
||||||
|
}
|
||||||
|
|
||||||
|
Root.Debug(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Debug2(message string, v ...interface{}) {
|
func Debug2(message string, v ...interface{}) {
|
||||||
|
@ -11,6 +11,10 @@ import (
|
|||||||
"github.com/grafana/grafana/pkg/setting"
|
"github.com/grafana/grafana/pkg/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
httpClient http.Client = http.Client{Timeout: time.Duration(10 * time.Second)}
|
||||||
|
)
|
||||||
|
|
||||||
type GrafanaNetPlugin struct {
|
type GrafanaNetPlugin struct {
|
||||||
Slug string `json:"slug"`
|
Slug string `json:"slug"`
|
||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
@ -54,10 +58,8 @@ func getAllExternalPluginSlugs() string {
|
|||||||
func checkForUpdates() {
|
func checkForUpdates() {
|
||||||
log.Trace("Checking for updates")
|
log.Trace("Checking for updates")
|
||||||
|
|
||||||
client := http.Client{Timeout: time.Duration(5 * time.Second)}
|
|
||||||
|
|
||||||
pluginSlugs := getAllExternalPluginSlugs()
|
pluginSlugs := getAllExternalPluginSlugs()
|
||||||
resp, err := client.Get("https://grafana.net/api/plugins/versioncheck?slugIn=" + pluginSlugs + "&grafanaVersion=" + setting.BuildVersion)
|
resp, err := httpClient.Get("https://grafana.net/api/plugins/versioncheck?slugIn=" + pluginSlugs + "&grafanaVersion=" + setting.BuildVersion)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Trace("Failed to get plugins repo from grafana.net, %v", err.Error())
|
log.Trace("Failed to get plugins repo from grafana.net, %v", err.Error())
|
||||||
@ -88,7 +90,7 @@ func checkForUpdates() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resp2, err := client.Get("https://raw.githubusercontent.com/grafana/grafana/master/latest.json")
|
resp2, err := httpClient.Get("https://raw.githubusercontent.com/grafana/grafana/master/latest.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Trace("Failed to get latest.json repo from github: %v", err.Error())
|
log.Trace("Failed to get latest.json repo from github: %v", err.Error())
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user