This repository has been archived by the owner. It is now read-only.
forked from hirefire/hirefire
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,038 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# encoding: utf-8 | ||
|
||
module HireFire | ||
module Backend | ||
module DelayedJob | ||
module ActiveRecord | ||
|
||
## | ||
# Counts the amount of queued jobs in the database, | ||
# failed jobs are excluded from the sum | ||
# | ||
# @return [Fixnum] the amount of pending jobs | ||
def jobs | ||
::Delayed::Job. | ||
where(:failed_at => nil). | ||
where('run_at <= ?', Time.now).count | ||
end | ||
|
||
## | ||
# Counts the amount of jobs that are locked by a worker | ||
# | ||
# @return [Fixnum] the amount of (assumably working) workers | ||
def workers | ||
::Delayed::Job. | ||
where('locked_by IS NOT NULL').count | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# encoding: utf-8 | ||
|
||
module HireFire | ||
module Backend | ||
module DelayedJob | ||
module Mongoid | ||
|
||
## | ||
# Counts the amount of queued jobs in the database, | ||
# failed jobs and jobs scheduled for the future are excluded | ||
# | ||
# @return [Fixnum] | ||
def jobs | ||
::Delayed::Job.where( | ||
:failed_at => nil, | ||
:run_at.lte => Time.now | ||
).count | ||
end | ||
|
||
## | ||
# Counts the amount of jobs that are locked by a worker | ||
# | ||
# @return [Fixnum] the amount of (assumably working) workers | ||
def workers | ||
::Delayed::Job. | ||
where(:locked_by.ne => nil).count | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# encoding: utf-8 | ||
|
||
module HireFire | ||
module Backend | ||
module Resque | ||
module Redis | ||
|
||
## | ||
# Counts the amount of queued jobs in the database, | ||
# failed jobs and jobs scheduled for the future are excluded | ||
# | ||
# @return [Fixnum] | ||
def jobs | ||
::Resque.info[:pending].to_i + ::Resque.info[:working].to_i | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.