fix(monitors): 修复短暂隐藏重开后的趋势误断层
This commit is contained in:
@@ -49,6 +49,21 @@ import Foundation
|
||||
extended.network = nil
|
||||
precondition(extended.downloadRate == nil)
|
||||
|
||||
var scheduledHistory = MetricHistory()
|
||||
scheduledHistory.recordScheduledInterval(30)
|
||||
extended.network = [NetworkInterfaceMetrics(name: "en0", received: 100, sent: 50, download: 20, upload: 10)]
|
||||
scheduledHistory.append(extended)
|
||||
scheduledHistory.recordScheduledInterval(30)
|
||||
scheduledHistory.recordScheduledInterval(2)
|
||||
scheduledHistory.recordScheduledInterval(.nan)
|
||||
scheduledHistory.recordScheduledInterval(-1)
|
||||
precondition(scheduledHistory.samples.last?.expectedInterval == 30)
|
||||
precondition(scheduledHistory.interfaces.values.allSatisfy { $0.last?.expectedInterval == 30 })
|
||||
scheduledHistory.append(extended)
|
||||
precondition(scheduledHistory.samples.map(\.expectedInterval) == [30, 2])
|
||||
precondition(scheduledHistory.interfaces.values.allSatisfy { $0.map(\.expectedInterval) == [30, 2] },
|
||||
"Every interface must preserve only the outgoing slow interval, then resume its normal cadence")
|
||||
|
||||
var history = MetricHistory()
|
||||
for index in 0..<100 {
|
||||
var item = MetricsSnapshot()
|
||||
|
||||
Reference in New Issue
Block a user