mirror of
https://github.com/fankes/beszel.git
synced 2025-10-20 02:09:28 +08:00
allow creation of 10m record if nine 1m records
This commit is contained in:
@@ -22,7 +22,7 @@ type LongerRecordData struct {
|
||||
shorterType string
|
||||
longerType string
|
||||
longerTimeDuration time.Duration
|
||||
expectedShorterRecords int
|
||||
minShorterRecords int
|
||||
}
|
||||
|
||||
type RecordDeletionData struct {
|
||||
@@ -40,25 +40,26 @@ func (rm *RecordManager) CreateLongerRecords() {
|
||||
recordData := []LongerRecordData{
|
||||
{
|
||||
shorterType: "1m",
|
||||
expectedShorterRecords: 10,
|
||||
// change to 9 from 10 to allow edge case timing or short pauses
|
||||
minShorterRecords: 9,
|
||||
longerType: "10m",
|
||||
longerTimeDuration: -10 * time.Minute,
|
||||
},
|
||||
{
|
||||
shorterType: "10m",
|
||||
expectedShorterRecords: 2,
|
||||
minShorterRecords: 2,
|
||||
longerType: "20m",
|
||||
longerTimeDuration: -20 * time.Minute,
|
||||
},
|
||||
{
|
||||
shorterType: "20m",
|
||||
expectedShorterRecords: 6,
|
||||
minShorterRecords: 6,
|
||||
longerType: "120m",
|
||||
longerTimeDuration: -120 * time.Minute,
|
||||
},
|
||||
{
|
||||
shorterType: "120m",
|
||||
expectedShorterRecords: 4,
|
||||
minShorterRecords: 4,
|
||||
longerType: "480m",
|
||||
longerTimeDuration: -480 * time.Minute,
|
||||
},
|
||||
@@ -111,7 +112,7 @@ func (rm *RecordManager) CreateLongerRecords() {
|
||||
)
|
||||
|
||||
// continue if not enough shorter records
|
||||
if err != nil || len(allShorterRecords) < recordData.expectedShorterRecords {
|
||||
if err != nil || len(allShorterRecords) < recordData.minShorterRecords {
|
||||
// log.Println("not enough shorter records. continue.", len(allShorterRecords), recordData.expectedShorterRecords)
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user