Always sort InhibitedBy & SilencedBy to ensure order don't change between update

This commit is contained in:
Łukasz Mierzwa
2017-07-01 10:03:07 -07:00
parent ca0403ea75
commit 8ced9d0a1c
4 changed files with 12 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ package v04
import (
"errors"
"sort"
"strconv"
"time"
@@ -111,6 +112,8 @@ func (m AlertMapper) GetAlerts(uri string, timeout time.Duration) ([]models.Aler
InhibitedBy: inhibitedBy,
SilencedBy: silencedBy,
}
sort.Strings(a.InhibitedBy)
sort.Strings(a.SilencedBy)
alertList = append(alertList, a)
}
ug := models.AlertGroup{

View File

@@ -6,6 +6,7 @@ package v05
import (
"errors"
"sort"
"time"
"github.com/blang/semver"
@@ -110,6 +111,8 @@ func (m AlertMapper) GetAlerts(uri string, timeout time.Duration) ([]models.Aler
InhibitedBy: inhibitedBy,
SilencedBy: silencedBy,
}
sort.Strings(a.InhibitedBy)
sort.Strings(a.SilencedBy)
alertList = append(alertList, a)
}
ug := models.AlertGroup{

View File

@@ -7,6 +7,7 @@ package v061
import (
"errors"
"sort"
"time"
"github.com/blang/semver"
@@ -109,6 +110,8 @@ func (m AlertMapper) GetAlerts(uri string, timeout time.Duration) ([]models.Aler
InhibitedBy: inhibitedBy,
SilencedBy: silencedBy,
}
sort.Strings(a.InhibitedBy)
sort.Strings(a.SilencedBy)
alertList = append(alertList, a)
}
ug := models.AlertGroup{

View File

@@ -7,6 +7,7 @@ package v062
import (
"errors"
"sort"
"time"
"github.com/blang/semver"
@@ -113,6 +114,8 @@ func (m AlertMapper) GetAlerts(uri string, timeout time.Duration) ([]models.Aler
InhibitedBy: inhibitedBy,
SilencedBy: silencedBy,
}
sort.Strings(a.InhibitedBy)
sort.Strings(a.SilencedBy)
alertList = append(alertList, a)
}
ug := models.AlertGroup{