File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 20
20
# a cache entry from a non-default branch (on an LRU basis). That should create
21
21
# enough space for a new cache entry.
22
22
23
- import datetime
23
+ from datetime import datetime
24
24
import requests
25
+ import operator
25
26
import os
26
27
27
28
DEFAULT_BRANCH_NAME = 'scip-ruby/master'
@@ -75,13 +76,13 @@ def default_main():
75
76
return
76
77
77
78
entries_and_times = [
78
- (x , datetime .fromisoformat (x ['last_accessed_at' ]))
79
+ (x , datetime .strptime (x ['last_accessed_at' ]. split ( '.' )[ 0 ], '%Y-%m-%dT%H:%M:%S' ))
79
80
for x in other_branch_cache_entries
80
81
]
81
82
82
83
# Sort descending based on timestamps, and evict the oldest one.
83
- sorted (entries_and_times , key = itemgetter (1 ))
84
- earliest_entry = entries_and_times [0 ]
84
+ sorted (entries_and_times , key = operator . itemgetter (1 ))
85
+ earliest_entry = entries_and_times [0 ][ 0 ]
85
86
86
87
if os .getenv ('DRY_RUN' ):
87
88
print ('dry run: Will evict:\n {}' .format (earliest_entry ))
You can’t perform that action at this time.
0 commit comments