Skip to content

Commit 8fceba5

Browse files
committed
BUGFIX: Timestamps < NOW should not be respected in the calculation
1 parent f2391fc commit 8fceba5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Classes/Eel/ElasticSearchQueryBuilder.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -828,15 +828,17 @@ public function cacheLifetime(): int
828828
$minTimestamps = array_filter([
829829
$convertDateResultToTimestamp(Arrays::getValueByPath($result, 'aggregations.minHiddenBeforeDateTime')),
830830
$convertDateResultToTimestamp(Arrays::getValueByPath($result, 'aggregations.minHiddenAfterDateTime'))
831-
]);
831+
], function ($value, $_) {
832+
return $value != 0 || $value > $this->now->getTimestamp();
833+
}, ARRAY_FILTER_USE_BOTH);
832834

833835
if (empty($minTimestamps)) {
834836
return 0;
835837
}
836838

837839
$minTimestamp = min($minTimestamps);
838840

839-
return $minTimestamp > $this->now->getTimestamp() ? $minTimestamp - $this->now->getTimestamp() : 0;
841+
return $minTimestamp - $this->now->getTimestamp();
840842
}
841843

842844
/**

0 commit comments

Comments
 (0)