Class: PlanMyStuff::Archive::Sweep
- Inherits:
-
Object
- Object
- PlanMyStuff::Archive::Sweep
- Defined in:
- lib/plan_my_stuff/archive/sweep.rb
Overview
Walks a single repo’s closed issues, archiving those that have aged past config.archive_closed_after_days. Excludes issues auto-closed by Reminders::Closer (metadata.closed_by_inactivity) and any that are already archived (marker timestamp or label).
Paginates Issue.list(state: :closed) until either an empty page or the hard MAX_PAGES cap. GitHub’s list_issues returns in created-desc order, so closed_at is not monotonic across pages; we can’t short-circuit on “this page is all within cutoff.” Each subsequent sweep skips already-archived issues cheaply via skip?, so the steady-state walk is bounded in practice.
Constant Summary collapse
- PAGE_SIZE =
50- MAX_PAGES =
20
Instance Method Summary collapse
-
#call ⇒ void
Runs the sweep.
-
#initialize(repo:, now: Time.now.utc) ⇒ Sweep
constructor
A new instance of Sweep.
Constructor Details
#initialize(repo:, now: Time.now.utc) ⇒ Sweep
Returns a new instance of Sweep.
23 24 25 26 |
# File 'lib/plan_my_stuff/archive/sweep.rb', line 23 def initialize(repo:, now: Time.now.utc) @repo = repo @now = now.utc end |
Instance Method Details
#call ⇒ void
This method returns an undefined value.
Runs the sweep. No-op when config.archiving_enabled is false.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/plan_my_stuff/archive/sweep.rb', line 32 def call return unless PlanMyStuff.configuration.archiving_enabled (1..MAX_PAGES).each do |page| issues = PlanMyStuff::Issue.list( repo: @repo, state: :closed, page: page, per_page: PAGE_SIZE, ) break if issues.empty? process(issues) end end |