Skip to content

Instantly share code, notes, and snippets.

@Evshved
Last active July 18, 2018 12:36
Show Gist options
  • Save Evshved/d209b46cfee05f8b01ece098d1045971 to your computer and use it in GitHub Desktop.
Save Evshved/d209b46cfee05f8b01ece098d1045971 to your computer and use it in GitHub Desktop.
sidekiq
whenever --update-crontab
class MonitoringController < ApplicationController
MAX_QUEUE_SIZE = 10_000.freeze
def queue
size = Sidekiq::Stats.new.queues.values.reduce(:+)
status = size < MAX_QUEUE_SIZE ? 'GOOD' : 'BAD'
render json: status, status: :ok
end
def scheduler
count = ScheduledFacebookWallPost.successful
.where('publish_at >= ?', 3.hour.ago)
.count
status = count.positive? ? ‘GOOD’ : ‘BAD’
render json: status, status: :ok
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment