Sha256: 646be1b26a1d6b4a93cfecc94feee321f6082c33a608cb396afed058d9eaf3d7

Contents?: true

Size: 757 Bytes

Versions: 11

Compression:

Stored size: 757 Bytes

Contents

namespace :blazer do
  desc "run checks"
  task :run_checks, [:schedule] => :environment do |_, args|
    Blazer.run_checks(schedule: args[:schedule] || ENV["SCHEDULE"])
  end

  desc "send failing checks"
  task send_failing_checks: :environment do
    Blazer.send_failing_checks
  end

  desc "archive queries"
  task archive_queries: :environment do
    abort "Audits must be enabled to archive" unless Blazer.audit
    abort "Missing status column - see https://github.com/ankane/blazer#23" unless Blazer::Query.column_names.include?("status")

    viewed_query_ids = Blazer::Audit.where("created_at > ?", 90.days.ago).group(:query_id).count.keys.compact
    Blazer::Query.active.where.not(id: viewed_query_ids).update_all(status: "archived")
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
blazer-2.4.8 lib/tasks/blazer.rake
blazer-2.4.7 lib/tasks/blazer.rake
blazer-2.4.6 lib/tasks/blazer.rake
blazer-2.4.5 lib/tasks/blazer.rake
blazer-2.4.4 lib/tasks/blazer.rake
blazer-2.4.3 lib/tasks/blazer.rake
blazer-2.4.2 lib/tasks/blazer.rake
blazer-2.4.1 lib/tasks/blazer.rake
blazer-2.4.0 lib/tasks/blazer.rake
blazer-2.3.1 lib/tasks/blazer.rake
blazer-2.3.0 lib/tasks/blazer.rake