Skip to content

Commit 0359de8

Browse files
authored
Do not clear end objects in TimeRangeCollectionState.OnCollectionComplete if granularity is zero (#256)
TimeRangeObjectState.Validate does not validate TimeRange if granularity is zero
1 parent b3b4ca1 commit 0359de8

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## v0.9.1 [2025-07-02]
2+
_Bug fixes_
3+
* Do not clear end objects in TimeRangeCollectionState.OnCollectionComplete if granularity is zero. Closes ([#251](https://github.com/turbot/tailpipe-plugin-sdk/issues/251))
4+
* TimeRangeObjectState.Validate does not validate TimeRange if granularity is zero
5+
16
## v0.9.0 [2025-07-02]
27
_Whats new_
38

collection_state/time_range_collection_state.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ func (t *TimeRangeCollectionState) OnCollectionComplete() error {
150150
if t.currentCollectionTimeRange == nil {
151151
return fmt.Errorf("cannot complete collection - no current collection set, Init must be called first")
152152
}
153+
// if we have no granularity we have nothing to do
154+
if t.Granularity == 0 {
155+
slog.Info("Granularity is zero - no collection complete action required")
156+
return nil
157+
}
158+
153159
// set the upper boundary time of the active range to the upper boundary time of the collection time range
154160
t.activeRange.setUpperBoundaryTime(t.currentCollectionTimeRange.EndTime())
155161

collection_state/time_range_object_state.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ func (s *TimeRangeObjectState) GetGranularity() time.Duration {
145145
}
146146

147147
func (s *TimeRangeObjectState) Validate() error {
148+
if s.Granularity == 0 {
149+
return nil
150+
}
148151
return s.TimeRange.Validate()
149152
}
150153

0 commit comments

Comments
 (0)