Implement paging and refactor stores to match new store interface with paging

This commit is contained in:
TwinProduction
2021-07-14 22:26:51 -04:00
committed by Chris
parent 677c7faffe
commit 7126d36d85
19 changed files with 421 additions and 404 deletions

View File

@ -0,0 +1,26 @@
package memory
import (
"testing"
"time"
"github.com/TwinProduction/gatus/core"
)
func BenchmarkProcessUptimeAfterResult(b *testing.B) {
uptime := core.NewUptime()
now := time.Now()
now = time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
// Start 12000 days ago
timestamp := now.Add(-12000 * 24 * time.Hour)
for n := 0; n < b.N; n++ {
processUptimeAfterResult(uptime, &core.Result{
Duration: 18 * time.Millisecond,
Success: n%15 == 0,
Timestamp: timestamp,
})
// Simulate service with an interval of 3 minutes
timestamp = timestamp.Add(3 * time.Minute)
}
b.ReportAllocs()
}