Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from flask import request, current_app

Expand All @@ -39,7 +39,7 @@ def post(self):
"""
Obsolete cached datasets older than N hours
"""
now = datetime.now()
now = datetime.now(timezone.utc)
try:
age = float(request.get_json().get("age", 24))
except Exception:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from datetime import datetime
from datetime import datetime, timezone
from unittest.mock import patch

from pytest import fixture
Expand All @@ -43,8 +43,8 @@ def fake_dataset_list(self):
) as dsfunc:
dsfunc.return_value = [
Dataset(
last_used=datetime(2022, 1, 1),
last_updated=datetime(2022, 1, 1),
last_used=datetime(2022, 1, 1, tzinfo=timezone.utc),
last_updated=datetime(2022, 1, 1, tzinfo=timezone.utc),
id=1,
name="not-orphaned",
events=100,
Expand All @@ -54,8 +54,8 @@ def fake_dataset_list(self):
did_finder="rucio",
),
Dataset(
last_used=datetime.now(),
last_updated=datetime.now(),
last_used=datetime.now(timezone.utc),
last_updated=datetime.now(timezone.utc),
id=2,
name="orphaned",
events=100,
Expand Down