allow creation of 10m record if nine 1m records

This commit is contained in:
Henry Dollman
2024-09-14 15:27:42 -04:00
parent f16e22e521
commit c8743201a2

View File

@@ -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
}