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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f9d5095b0da933e653ac5a47bc0a0a0057ad48b
4
- data.tar.gz: 9daee302488e577371f041188e7d0f84d9833913
3
+ metadata.gz: e04d6a6c4cadba4ed663f1d6d23bf341badd662b
4
+ data.tar.gz: 819e6a8d6fd3a2b4ed8ee7d9de01cec7dab6fc7b
5
5
  SHA512:
6
- metadata.gz: d356b101fd6427b204c46317604e2791135810173480b8ddfe4edb6c991008c9369b260dc576a7500ef33b8475ddbde41dab8d0bf281ccece6925e7aa75259a6
7
- data.tar.gz: c6023a20103f5fdf9744e82435b2a68a6c2ec0407225602623886ede7297883a73e0523a4f664de5125ddc32318384122e2cf568eab5c5f7f46d0f6073cfb20d
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
@@ -141,8 +141,6 @@ module SidekiqScheduler
141
141
 
142
142
  if klass.respond_to?(:sidekiq_options)
143
143
  klass.sidekiq_options['queue']
144
- elsif klass.respond_to?(:queue_name)
145
- klass.queue_name
146
144
  end
147
145
  end
148
146
 
@@ -1,5 +1,5 @@
1
1
  module SidekiqScheduler
2
2
 
3
- VERSION = '2.1.7'
3
+ VERSION = '2.1.8'
4
4
 
5
5
  end
@@ -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 = { queue: config['queue'] }
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
@@ -7,6 +7,7 @@ cs:
7
7
  queue: Fronta
8
8
  arguments: Argumenty
9
9
  enqueue_now: Zařadit nyní
10
+ last_time: Naposled
10
11
  next_time: Příště
11
12
  no_next_time: no next execution for this job
12
13
  disable: Zakázat
data/web/locales/de.yml CHANGED
@@ -7,6 +7,7 @@ de:
7
7
  queue: Warteschlange
8
8
  arguments: Argumente
9
9
  enqueue_now: Jetzt hinzufügen
10
+ last_time: Letzte Ausführung
10
11
  next_time: Nächste Ausführung
11
12
  no_next_time: Keine zukünftige Ausführung für diesen Job
12
13
  disable: Deaktivieren
data/web/locales/en.yml CHANGED
@@ -7,6 +7,7 @@ en:
7
7
  queue: Queue
8
8
  arguments: Arguments
9
9
  enqueue_now: Enqueue now
10
+ last_time: Last Time
10
11
  next_time: Next Time
11
12
  no_next_time: no next execution for this job
12
13
  disable: Disable
data/web/locales/es.yml CHANGED
@@ -7,6 +7,7 @@ es:
7
7
  queue: Cola
8
8
  arguments: Argumentos
9
9
  enqueue_now: Encolar ahora
10
+ last_time: Última ejecución
10
11
  next_time: Próxima ejecución
11
12
  no_next_time: esta tarea no se volverá a ejecutar
12
13
  disable: Inhabilitar
@@ -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
@@ -7,6 +7,7 @@ zh-cn:
7
7
  queue: 队列
8
8
  arguments: 参数
9
9
  enqueue_now: 立即执行
10
+ last_time: 最后运行时间
10
11
  next_time: 下次执行时间
11
12
  no_next_time: 已无后续作业
12
13
  disable: 禁用
@@ -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><span style="<%= 'text-decoration:line-through' unless job.enabled? %>">
30
- <%= job.next_time || t('no_next_time') %>
31
- </span></td>
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.7
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-06-29 00:00:00.000000000 Z
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/