Skip to content
Merged
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
7 changes: 6 additions & 1 deletion nix-channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
THREADS = int(os.getenv('NIX_MIRROR_THREADS', 10))
DELETE_OLD = os.getenv('NIX_MIRROR_DELETE_OLD', '1') == '1'
RETAIN_DAYS = float(os.getenv('NIX_MIRROR_RETAIN_DAYS', 30))
CLONE_SINCE_DAYS = float(os.getenv('NIX_MIRROR_CLONE_SINCE_DAYS', 360))

STORE_DIR = 'store'
RELEASES_DIR = 'releases'
Expand All @@ -44,7 +45,7 @@
# be too old and defunct.
#
# [1]: https://discourse.nixos.org/t/announcement-moving-nixos-org-to-netlify/6212
CLONE_SINCE = datetime(2020, 3, 6, tzinfo=pytz.utc)
CLONE_SINCE = datetime.now() - timedelta(days=CLONE_SINCE_DAYS)
TIMEOUT = 60

working_dir = Path(WORKING_DIR)
Expand Down Expand Up @@ -394,6 +395,10 @@ def garbage_collect():
date_str = date_match[0]
released_date = datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S')

# Very old channel version, ignore for GC
if released_date < CLONE_SINCE:
continue

if released_date >= time_threshold:
alive.add(release)

Expand Down
Loading