sidekiq-scheduler 2.1.7 → 2.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sidekiq-scheduler/job_presenter.rb +9 -0
- data/lib/sidekiq-scheduler/schedule.rb +0 -2
- data/lib/sidekiq-scheduler/version.rb +1 -1
- data/lib/sidekiq/scheduler.rb +19 -1
- data/web/locales/cs.yml +1 -0
- data/web/locales/de.yml +1 -0
- data/web/locales/en.yml +1 -0
- data/web/locales/es.yml +1 -0
- data/web/locales/fr.yml +13 -0
- data/web/locales/zh-cn.yml +1 -0
- data/web/views/recurring_jobs.erb +7 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e04d6a6c4cadba4ed663f1d6d23bf341badd662b
|
4
|
+
data.tar.gz: 819e6a8d6fd3a2b4ed8ee7d9de01cec7dab6fc7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a580696e13e45a8b3f9e92bc89bfce86473d342624bac3d417d45f3dd8c487981f26c0dc614fc48712b2f23a314876ce605390e60277feb5e1e17962087cfeeb
|
7
|
+
data.tar.gz: 3526ddffdbe02cbbfbca9a125b4d860db14f6e8109cda2fcffb1570134376e38719b66ffffeddd19d6c453928e74aed950d2cd5d8a231625d953ae949e335260
|
@@ -24,6 +24,15 @@ module SidekiqScheduler
|
|
24
24
|
relative_time(Time.parse(execution_time)) if execution_time
|
25
25
|
end
|
26
26
|
|
27
|
+
# Returns the last execution time for the job
|
28
|
+
#
|
29
|
+
# @return [String] with the job's last time
|
30
|
+
def last_time
|
31
|
+
execution_time = Sidekiq.redis { |r| r.hget(Sidekiq::Scheduler.last_times_key, name) }
|
32
|
+
|
33
|
+
relative_time(Time.parse(execution_time)) if execution_time
|
34
|
+
end
|
35
|
+
|
27
36
|
# Returns the interval for the job
|
28
37
|
#
|
29
38
|
# @return [String] with the job's interval
|
data/lib/sidekiq/scheduler.rb
CHANGED
@@ -144,6 +144,14 @@ module Sidekiq
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
# Pushes job's last execution time
|
148
|
+
#
|
149
|
+
# @param [String] name The job's name
|
150
|
+
# @param [Time] last_time The job's last execution time
|
151
|
+
def update_job_last_time(name, last_time)
|
152
|
+
Sidekiq.redis { |r| r.hset(last_times_key, name, last_time) } if last_time
|
153
|
+
end
|
154
|
+
|
147
155
|
# Returns true if the given schedule config hash matches the current
|
148
156
|
# ENV['RAILS_ENV']
|
149
157
|
def rails_env_matches?(config)
|
@@ -237,7 +245,9 @@ module Sidekiq
|
|
237
245
|
end
|
238
246
|
|
239
247
|
def enqueue_with_active_job(config)
|
240
|
-
options = {
|
248
|
+
options = {
|
249
|
+
queue: config['queue']
|
250
|
+
}.keep_if { |_, v| !v.nil? }
|
241
251
|
|
242
252
|
initialize_active_job(config['class'], config['args']).enqueue(options)
|
243
253
|
end
|
@@ -344,6 +354,13 @@ module Sidekiq
|
|
344
354
|
'sidekiq-scheduler:next_times'
|
345
355
|
end
|
346
356
|
|
357
|
+
# Returns the key of the Redis hash for job's last execution times hash
|
358
|
+
#
|
359
|
+
# @return [String] with the key
|
360
|
+
def last_times_key
|
361
|
+
'sidekiq-scheduler:last_times'
|
362
|
+
end
|
363
|
+
|
347
364
|
# Returns the Redis's key for saving schedule states.
|
348
365
|
#
|
349
366
|
# @return [String] with the key
|
@@ -367,6 +384,7 @@ module Sidekiq
|
|
367
384
|
def new_rufus_scheduler
|
368
385
|
Rufus::Scheduler.new(rufus_scheduler_options).tap do |scheduler|
|
369
386
|
scheduler.define_singleton_method(:on_post_trigger) do |job, triggered_time|
|
387
|
+
Sidekiq::Scheduler.update_job_last_time(job.tags[0], triggered_time)
|
370
388
|
Sidekiq::Scheduler.update_job_next_time(job.tags[0], job.next_time)
|
371
389
|
end
|
372
390
|
end
|
data/web/locales/cs.yml
CHANGED
data/web/locales/de.yml
CHANGED
data/web/locales/en.yml
CHANGED
data/web/locales/es.yml
CHANGED
data/web/locales/fr.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
fr:
|
2
|
+
recurring_jobs: Tâches récurrentes
|
3
|
+
name: Nom
|
4
|
+
description: Description
|
5
|
+
interval: Intervalle
|
6
|
+
class: Classe
|
7
|
+
queue: Queue
|
8
|
+
arguments: Arguments
|
9
|
+
enqueue_now: Ajouter à la queue
|
10
|
+
next_time: Quand
|
11
|
+
no_next_time: Pas d'exécution prévue pour cette tâche
|
12
|
+
disable: Désactiver
|
13
|
+
enable: Activer
|
data/web/locales/zh-cn.yml
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
<th><%= t('class') %></th>
|
11
11
|
<th><%= t('queue') %></th>
|
12
12
|
<th><%= t('arguments') %></th>
|
13
|
+
<th><%= t('last_time') %></th>
|
13
14
|
<th><%= t('next_time') %></th>
|
14
15
|
<th></th>
|
15
16
|
</tr>
|
@@ -26,9 +27,12 @@
|
|
26
27
|
<a href="<%= root_path %>queues/<%= job.queue %>"><%= job.queue %></a>
|
27
28
|
</td>
|
28
29
|
<td><%= job['args'] %></td>
|
29
|
-
<td
|
30
|
-
|
31
|
-
|
30
|
+
<td><%= job.last_time %></td>
|
31
|
+
<td>
|
32
|
+
<span style="<%= 'text-decoration:line-through' unless job.enabled? %>">
|
33
|
+
<%= job.next_time || t('no_next_time') %>
|
34
|
+
</span>
|
35
|
+
</td>
|
32
36
|
<td class="text-center">
|
33
37
|
<a class="btn btn-warn btn-xs" href="<%= root_path %>recurring-jobs/<%= URI.escape(job.name) %>/enqueue">
|
34
38
|
<%= t('enqueue_now') %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Morton Jonuschat
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-08-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sidekiq
|
@@ -245,6 +245,7 @@ files:
|
|
245
245
|
- web/locales/de.yml
|
246
246
|
- web/locales/en.yml
|
247
247
|
- web/locales/es.yml
|
248
|
+
- web/locales/fr.yml
|
248
249
|
- web/locales/zh-cn.yml
|
249
250
|
- web/views/recurring_jobs.erb
|
250
251
|
homepage: https://moove-it.github.io/sidekiq-scheduler/
|