mirror of
https://github.com/nikdoof/vsphere-influxdb-go.git
synced 2025-12-18 21:19:21 +00:00
add vendoring with go dep
This commit is contained in:
23
vendor/github.com/influxdata/influxdb/influxql/monitor.go
generated
vendored
Normal file
23
vendor/github.com/influxdata/influxdb/influxql/monitor.go
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
package influxql
|
||||
|
||||
import "time"
|
||||
|
||||
// PointLimitMonitor is a query monitor that exits when the number of points
|
||||
// emitted exceeds a threshold.
|
||||
func PointLimitMonitor(itrs Iterators, interval time.Duration, limit int) QueryMonitorFunc {
|
||||
return func(closing <-chan struct{}) error {
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
stats := itrs.Stats()
|
||||
if stats.PointN >= limit {
|
||||
return ErrMaxSelectPointsLimitExceeded(stats.PointN, limit)
|
||||
}
|
||||
case <-closing:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user