Graylog2 / Graylog2/graylog2-server
Refactor TimeRange classes
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
The non-absolute time range objects used for searches currently reevaluate their start and end dates on each method call.
This can lead to strange behavior (as in #2382) where even the same instance of a 60 second relative range returns a different interval when asked repeatedly.
In some other cases (#2335) we need this behavior because the instances stay in memory for a long time, but we want the searches to reflect the time range anchored at `now`.
One option would be to refactor the time range creators to default to `AbsoluteRange` creating instances that never change their interval.
If needed code can also create "reevaluating" instances using different methods which stand out a little more.
``` java
// stays fixed
AbsoluteRange a = RelativeRange.create(60);
// re-evaluates every time
RelativeRange r = RelativeRange.createMoving(60);
```
related to #2382 #2335 #2301
Contributor guide
Assessment
This issue has not been assessed yet.