web47core 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 027050b509063906f7510bbc18d00652ed88a9c34946aa1173ced96221e29680
4
- data.tar.gz: cb925aad21d8da7328a1be41bbf0f8d64321d54d024826b0647aa8b89953ab5b
3
+ metadata.gz: 862ce506f9e7921057f3cb89f87c9adc51d66880f0892af68bf5cd431f60776f
4
+ data.tar.gz: ba0e7a0c12e80eb580eb0e4ba220b718a5b044665003e59a9c5eb33c032b7a9a
5
5
  SHA512:
6
- metadata.gz: 4ef4f598c310b69475f0d8aef4b119d8f5c554aeb9b2a2589b1c4cd025dbe53c27d35435b098d720043f304d9a94e976aef24a5df5f92a1f0073e42aff2e1fd9
7
- data.tar.gz: 54f5b240cdc040231fba74047703aa98e52521fc98127d76b0eb5c2b555db4529ec21340dd1534565b7d7ac128c141f1a5d544a5bd6f384a6f669156e30c8dba
6
+ metadata.gz: d0ed82a52e27ddbb93dba4a2cb2970a9171aa815043e68c5ec7eb6251c045ccdb8f1c2b4e187a3635cab09784e45b58f718e752800e62b24c27aba3db5c5bb9d
7
+ data.tar.gz: a839df6e9d4247884a4f37c66e1f18322c59537cc7d03ab33bcc04263ba990eea06ece2b55676e7032e16192033e3edf208ccaa48e7b2f782990094fbdaa184c
@@ -10,7 +10,7 @@ module CoreDelayedJobsController
10
10
  #
11
11
  def index
12
12
  authorize! :read, Delayed::Backend::Mongoid::Job
13
- @delayed_jobs = Delayed::Backend::Mongoid::Job.desc(:locked_by).asc(:priority, :run_at).limit(100)
13
+ delayed_jobs
14
14
  end
15
15
 
16
16
  def show
@@ -23,7 +23,7 @@ module CoreDelayedJobsController
23
23
  def destroy_all
24
24
  authorize! :manage, Delayed::Backend::Mongoid::Job
25
25
  failed_only = params[:failed_only].eql?('true')
26
- Delayed::Backend::Mongoid::Job.each do |job|
26
+ delayed_jobs.each do |job|
27
27
  next if failed_only && !job.failed?
28
28
 
29
29
  job.destroy
@@ -41,7 +41,7 @@ module CoreDelayedJobsController
41
41
  def resubmit_all
42
42
  authorize! :read, Delayed::Backend::Mongoid::Job
43
43
  failed_only = params[:failed_only].eql?('true')
44
- Delayed::Backend::Mongoid::Job.each do |job|
44
+ delayed_jobs.each do |job|
45
45
  next if failed_only && !job.failed?
46
46
 
47
47
  job.resubmit
@@ -79,9 +79,28 @@ module CoreDelayedJobsController
79
79
  redirect_to index_path
80
80
  end
81
81
 
82
- private
83
-
82
+ #
83
+ # Fetch the required job by id
84
+ #
84
85
  def delayed_job
85
86
  @delayed_job ||= Delayed::Backend::Mongoid::Job.find(params[:id])
86
87
  end
88
+
89
+ #
90
+ # Find the first jobs for index or deleting all
91
+ #
92
+ def delayed_jobs
93
+ @delayed_jobs ||= Delayed::Backend::Mongoid::Job.
94
+ order_by(locked_by: :desc, priority: :asc, run_at: :asc).
95
+ limit(delayed_jobs_limit)
96
+ end
97
+
98
+ #
99
+ # Define the limit of jobs to fetch for the index of delete all/resubmit all
100
+ #
101
+ # Override this in your project if you want a different limit
102
+ #
103
+ def delayed_jobs_limit
104
+ 100
105
+ end
87
106
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport