mirror of
https://github.com/axllent/mailpit.git
synced 2025-08-13 20:04:49 +02:00
Fix: Do not check latest release for Prometheus statistics (#522)
This commit is contained in:
@@ -108,7 +108,7 @@ func InitMetrics() {
|
||||
|
||||
// UpdateMetrics updates all metrics with current values
|
||||
func UpdateMetrics() {
|
||||
info := stats.Load()
|
||||
info := stats.Load(false)
|
||||
|
||||
totalMessages.Set(float64(info.Messages))
|
||||
unreadMessages.Set(float64(info.Unread))
|
||||
|
@@ -81,7 +81,7 @@ func getBackoff(errCount int) time.Duration {
|
||||
}
|
||||
|
||||
// Load the current statistics
|
||||
func Load() AppInformation {
|
||||
func Load(detectLatestVersion bool) AppInformation {
|
||||
info := AppInformation{}
|
||||
info.Version = config.Version
|
||||
|
||||
@@ -98,7 +98,7 @@ func Load() AppInformation {
|
||||
|
||||
if config.DisableVersionCheck {
|
||||
info.LatestVersion = "disabled"
|
||||
} else {
|
||||
} else if detectLatestVersion {
|
||||
mu.RLock()
|
||||
cacheValid := time.Now().Before(vCache.expiry)
|
||||
cacheValue := vCache.value
|
||||
|
@@ -28,7 +28,7 @@ func AppInfo(w http.ResponseWriter, _ *http.Request) {
|
||||
// 400: ErrorResponse
|
||||
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(stats.Load()); err != nil {
|
||||
if err := json.NewEncoder(w).Encode(stats.Load(true)); err != nil {
|
||||
httpError(w, err.Error())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user