Sha256: 58168fe84dfdba1315b2118e31f607390acde30f08b00907987b484fd7119425

Contents?: true

Size: 698 Bytes

Versions: 9

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module Cron
  #
  # Clean up Jobs
  #
  class TrimCommandJobs < TrimCollection
    #
    # Fetch each Audit Log and delete it if hasn't been updated in 90 days
    #
    def collection
      CommandJob.all
    end

    #
    # Check which audit logs we wanted to be deleted
    #
    # Should be older than 90 days and either not a user model audit log or the model associated with
    # the UserModelAuditLog has been deleted
    #
    def allowed_time_for_item(job)
      job.ttl.days.ago.utc
    rescue StandardError => error
      App47Logger.log_warn "Unable to determine if job should be archived: #{job.inspect}", error
      30.days.ago.utc
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
web47core-3.2.20 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.19 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.18 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.17 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.16 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.15 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.14 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.13 lib/app/jobs/cron/trim_command_jobs.rb
web47core-3.2.12 lib/app/jobs/cron/trim_command_jobs.rb