module Sidekiqtui

Constants

VERSION

Public Instance Methods

configure() click to toggle source
# File lib/sidekiqtui.rb, line 44
def configure
  Sidekiq.configure_server do |config|
    config.logger = nil
  end
end
run() click to toggle source
# File lib/sidekiqtui.rb, line 16
def run
  configure

  box = TTY::Box.frame(
    width: TTY::Screen.width,
    height: TTY::Screen.height,
    title: { top_left: 'Scheduled Jobs', bottom_right: Sidekiqtui::VERSION }
  ) do
    ss = Sidekiq::ScheduledSet.new
    jobs = ss.map do |job|
      [
        "in #{time_ago_in_words(job.at)}",
        job.queue,
        job.item['class'],
        job.args.join(', ')
      ]
    end.reverse

    table = TTY::Table.new(
      %w[When Queue Job Arguments],
      jobs
    )
    table.render(:unicode)
  end

  print box
end