good_job 3.23.0 → 3.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4b22e7bf97af388b110d33742f0e1ce762570a509c85b8abd8425d668f691c4
4
- data.tar.gz: 4f5ab8ec5fef5a2996f917851cea61a967fc73ac08afcd61edc248a5f121606e
3
+ metadata.gz: 5b464ea5a307aa615b5800649e4ff4083276900fe42bfb32edfc9ed66c470914
4
+ data.tar.gz: 7ff522ebb69f55a222a089ddc7c2b1fc2e0835603bcf515a630b2b27a2e90b7a
5
5
  SHA512:
6
- metadata.gz: b20eabb8bd33b6c1223a8d60244a75681c939193ba22904531cf4c5d4f92ca2266665e2feb60dd7ee9db8b6ba017d3980bd789b4d90c7c9806b5db42ce08bdb9
7
- data.tar.gz: da0c451f930fb9226a74ce6d03aea3dd5bdb61cfff4e00d3e9f0664032105e357eea653d86c79759f3b67a999e59306f4cc33f9684d7edcdea48fee322ad2e27
6
+ metadata.gz: ae2eb90d2b35711d3d4ade8ed678bba89e36fa32eb36b6bb291a4b99fbe0d60b4ea2a143521f9b20b6d386b745d690f8e6b99467b0ec1b05d9e44709f71a6b7f
7
+ data.tar.gz: a695f55188543d9ea6d53f1f25c4e3cfb311d4a4d7dddbed342b8034e5d09cf911f212e57fe4fba0ab64c0cc8ce0f9dcb2529756dc9c701403e5e6ee1b8113e7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.24.0](https://github.com/bensheldon/good_job/tree/v3.24.0) (2024-02-12)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.23.0...v3.24.0)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Fix batches so that retried-and-successful jobs leave the batch succeeded [\#1243](https://github.com/bensheldon/good_job/pull/1243) ([bensheldon](https://github.com/bensheldon))
10
+ - Use the job class as the default concurrency key if none is provided [\#1145](https://github.com/bensheldon/good_job/pull/1145) ([Earlopain](https://github.com/Earlopain))
11
+
12
+ **Closed issues:**
13
+
14
+ - Batch callbacks not run when job fails, then succeeds [\#1239](https://github.com/bensheldon/good_job/issues/1239)
15
+ - Broken pipe @ io\_writev - \<STDERR\> \(Errno::EPIPE\) [\#1233](https://github.com/bensheldon/good_job/issues/1233)
16
+ - PG::UniqueViolation unique constraint "index\_good\_jobs\_on\_cron\_key\_and\_cron\_at\_cond" [\#1230](https://github.com/bensheldon/good_job/issues/1230)
17
+ - Default concurrency key [\#1110](https://github.com/bensheldon/good_job/issues/1110)
18
+
19
+ **Merged pull requests:**
20
+
21
+ - Use Ruby 3.3 for development; add Bootsnap; update to Rails 7.1.3 [\#1240](https://github.com/bensheldon/good_job/pull/1240) ([bensheldon](https://github.com/bensheldon))
22
+ - Tweak docs for new concurrency default [\#1229](https://github.com/bensheldon/good_job/pull/1229) ([Earlopain](https://github.com/Earlopain))
23
+ - Brazilian Portuguese locale [\#1226](https://github.com/bensheldon/good_job/pull/1226) ([hss-mateus](https://github.com/hss-mateus))
24
+
3
25
  ## [v3.23.0](https://github.com/bensheldon/good_job/tree/v3.23.0) (2024-01-23)
4
26
 
5
27
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.22.0...v3.23.0)
data/README.md CHANGED
@@ -511,12 +511,25 @@ class MyJob < ApplicationJob
511
511
 
512
512
  # A unique key to be globally locked against.
513
513
  # Can be String or Lambda/Proc that is invoked in the context of the job.
514
+ #
515
+ # If a key is not provided GoodJob will use the job class name.
516
+ #
517
+ # To disable concurrency control, for example in a subclass, set the
518
+ # key explicitly to nil (e.g. `key: nil` or `key: -> { nil }`)
519
+ #
520
+ # If you provide a custom concurrency key (for example, if concurrency is supposed
521
+ # to be controlled by the first job argument) make sure that it is sufficiently unique across
522
+ # jobs and queues by adding the job class or queue to the key yourself, if needed.
523
+ #
524
+ # Note: When using a model instance as part of your custom concurrency key, make sure
525
+ # to explicitly use its `id` or `to_global_id` because otherwise it will not stringify as expected.
526
+ #
514
527
  # Note: Arguments passed to #perform_later can be accessed through Active Job's `arguments` method
515
528
  # which is an array containing positional arguments and, optionally, a kwarg hash.
516
- key: -> { "MyJob-#{arguments.first}-#{arguments.last[:version]}" } # MyJob.perform_later("Alice", version: 'v2') => "MyJob-Alice-v2"
529
+ key: -> { "#{self.class.name}-#{queue_name}-#{arguments.first}-#{arguments.last[:version]}" } # MyJob.perform_later("Alice", version: 'v2') => "MyJob-default-Alice-v2"
517
530
  )
518
531
 
519
- def perform(first_name)
532
+ def perform(first_name, version:)
520
533
  # do work
521
534
  end
522
535
  end
@@ -525,8 +538,8 @@ end
525
538
  When testing, the resulting concurrency key value can be inspected:
526
539
 
527
540
  ```ruby
528
- job = MyJob.perform_later("Alice")
529
- job.good_job_concurrency_key #=> "MyJob-Alice"
541
+ job = MyJob.perform_later("Alice", version: 'v1')
542
+ job.good_job_concurrency_key #=> "MyJob-default-Alice-v1"
530
543
  ```
531
544
 
532
545
  #### How concurrency controls work
@@ -46,7 +46,7 @@ module GoodJob
46
46
  end
47
47
 
48
48
  def _continue_discard_or_finish(execution = nil, lock: true)
49
- execution_discarded = execution && execution.error.present? && execution.retried_good_job_id.nil?
49
+ execution_discarded = execution && execution.error.present? && execution.finished_at && execution.retried_good_job_id.nil?
50
50
  take_advisory_lock(lock) do
51
51
  Batch.within_thread(batch_id: nil, batch_callback_id: id) do
52
52
  reload
@@ -0,0 +1,243 @@
1
+ ---
2
+ pt-BR:
3
+ good_job:
4
+ actions:
5
+ destroy: Excluir
6
+ discard: Descartar
7
+ force_discard: Forçar descarte
8
+ inspect: Inspecionar
9
+ reschedule: Reagendar
10
+ retry: Tentar novamente
11
+ batches:
12
+ index:
13
+ older_batches: Lotes antigos
14
+ pending_migrations: O GoodJob tem migrações pendentes no banco de dados.
15
+ title: Lotes
16
+ jobs:
17
+ actions:
18
+ confirm_destroy: Tem certeza de que deseja excluir esta tarefa?
19
+ confirm_discard: Tem certeza de que deseja descartar esta tarefa?
20
+ confirm_reschedule: Tem certeza de que deseja reagendar esta tarefa?
21
+ confirm_retry: Tem certeza de que deseja tentar novamente esta tarefa?
22
+ destroy: Excluir Tarefa
23
+ discard: Descartar Tarefa
24
+ reschedule: Reagendar Tarefa
25
+ retry: Tentar Tarefa Novamente
26
+ title: Ações
27
+ no_jobs_found: Nenhuma tarefa encontrada.
28
+ show:
29
+ attributes: Atributos
30
+ batched_jobs: Tarefas em Lote
31
+ callback_jobs: Tarefas de Callback
32
+ table:
33
+ no_batches_found: Nenhum lote encontrado.
34
+ cron_entries:
35
+ actions:
36
+ confirm_disable: Tem certeza de que deseja desativar esta tarefa programada?
37
+ confirm_enable: Tem certeza de que deseja ativar esta tarefa programada?
38
+ confirm_enqueue: Tem certeza de que deseja enfileirar esta tarefa programada agora?
39
+ disable: Desativar tarefa programada
40
+ enable: Ativar tarefa programada
41
+ enqueue: Enfileirar tarefa programada agora
42
+ disable:
43
+ notice: A tarefa programada foi desativada.
44
+ enable:
45
+ notice: A tarefa programada foi ativada.
46
+ enqueue:
47
+ notice: A tarefa programada foi enfileirada.
48
+ index:
49
+ no_cron_schedules_found: Nenhuma tarefa programada encontrada.
50
+ title: Tarefas Programadas
51
+ pending_migrations: Requer migração pendente do GoodJob no banco de dados.
52
+ show:
53
+ cron_entry_key: Chave da Tarefa Programada
54
+ datetime:
55
+ distance_in_words:
56
+ about_x_hours:
57
+ one: cerca de 1 hora
58
+ other: cerca de %{count} horas
59
+ about_x_months:
60
+ one: cerca de 1 mês
61
+ other: cerca de %{count} meses
62
+ about_x_years:
63
+ one: cerca de 1 ano
64
+ other: cerca de %{count} anos
65
+ almost_x_years:
66
+ one: quase 1 ano
67
+ other: quase %{count} anos
68
+ half_a_minute: meio minuto
69
+ less_than_x_minutes:
70
+ one: menos de um minuto
71
+ other: menos de %{count} minutos
72
+ less_than_x_seconds:
73
+ one: menos de 1 segundo
74
+ other: menos de %{count} segundos
75
+ over_x_years:
76
+ one: mais de 1 ano
77
+ other: mais de %{count} anos
78
+ x_days:
79
+ one: 1 dia
80
+ other: "%{count} dias"
81
+ x_minutes:
82
+ one: 1 minuto
83
+ other: "%{count} minutos"
84
+ x_months:
85
+ one: 1 mês
86
+ other: "%{count} meses"
87
+ x_seconds:
88
+ one: 1 segundo
89
+ other: "%{count} segundos"
90
+ x_years:
91
+ one: 1 ano
92
+ other: "%{count} anos"
93
+ duration:
94
+ hours: "%{hour}h %{min}m"
95
+ less_than_10_seconds: "%{sec}s"
96
+ milliseconds: "%{ms}ms"
97
+ minutes: "%{min}m %{sec}s"
98
+ seconds: "%{sec}s"
99
+ error_event:
100
+ discarded: Descartado
101
+ handled: Tratado
102
+ interrupted: Interrompido
103
+ retried: Tentado novamente
104
+ retry_stopped: Tentativa de reexecução interrompida
105
+ unhandled: Não tratado
106
+ helpers:
107
+ relative_time:
108
+ future: em %{time}
109
+ past: "%{time} atrás"
110
+ jobs:
111
+ actions:
112
+ confirm_destroy: Tem certeza de que deseja excluir a tarefa?
113
+ confirm_discard: Tem certeza de que deseja descartar a tarefa?
114
+ confirm_force_discard: 'Tem certeza de que deseja forçar o descarte desta tarefa? A tarefa será marcada como descartada, mas a tarefa em execução não será interrompida - no entanto, ela não será tentada novamente em falhas.
115
+
116
+ '
117
+ confirm_reschedule: Tem certeza de que deseja reagendar a tarefa?
118
+ confirm_retry: Tem certeza de que deseja tentar novamente a tarefa?
119
+ destroy: Excluir tarefa
120
+ discard: Descartar tarefa
121
+ force_discard: Forçar descarte de tarefa
122
+ reschedule: Reagendar tarefa
123
+ retry: Tentar tarefa novamente
124
+ destroy:
125
+ notice: A tarefa foi excluida.
126
+ discard:
127
+ notice: A tarefa foi descartada.
128
+ executions:
129
+ in_queue: na fila
130
+ runtime: tempo de execução
131
+ title: Execuções
132
+ force_discard:
133
+ notice: A tarefa foi forçadamente descartada. Ela continuará a ser executada, mas não será tentada novamente em caso de falhas.
134
+ index:
135
+ job_pagination: Paginação de Tarefa
136
+ older_jobs: Tarefas antigas
137
+ reschedule:
138
+ notice: A tarefa foi reagendada.
139
+ retry:
140
+ notice: A tarefa foi tentada novamente.
141
+ show:
142
+ jobs: Tarefas
143
+ table:
144
+ actions:
145
+ apply_to_all:
146
+ one: Aplicar a todas 1 tarefa.
147
+ other: Aplicar a todas %{count} tarefas.
148
+ confirm_destroy_all: Tem certeza de que deseja excluir as tarefas selecionadas?
149
+ confirm_discard_all: Tem certeza de que deseja descartar as tarefas selecionadas?
150
+ confirm_reschedule_all: Tem certeza de que deseja reagendar as tarefas selecionadas?
151
+ confirm_retry_all: Tem certeza de que deseja tentar novamente as tarefas selecionadas?
152
+ destroy_all: Excluir tudo
153
+ discard_all: Descartar tudo
154
+ reschedule_all: Reagendar tudo
155
+ retry_all: Tentar novamente tudo
156
+ title: Ações
157
+ no_jobs_found: Nenhuma tarefa encontrada.
158
+ toggle_actions: Alternar Ações
159
+ toggle_all_jobs: Alternar todas as tarefas
160
+ models:
161
+ batch:
162
+ created: Criado
163
+ created_at: Criado em
164
+ discarded: Descartado
165
+ discarded_at: Descartado em
166
+ enqueued: Enfileirado
167
+ enqueued_at: Enfileirado em
168
+ finished: Concluído
169
+ finished_at: Concluído em
170
+ jobs: Tarefas
171
+ name: Nome
172
+ cron:
173
+ class: Classe
174
+ last_run: Última execução
175
+ next_scheduled: Próximo agendamento
176
+ schedule: Agendamento
177
+ job:
178
+ arguments: Argumentos
179
+ attempts: Tentativas
180
+ priority: Prioridade
181
+ queue: Fila
182
+ number:
183
+ format:
184
+ delimiter: "."
185
+ separator: ","
186
+ human:
187
+ decimal_units:
188
+ delimiter: "."
189
+ format: "%n%u"
190
+ precision: 3
191
+ separator: ","
192
+ units:
193
+ billion: B
194
+ million: M
195
+ quadrillion: Q
196
+ thousand: K
197
+ trillion: T
198
+ unit: ''
199
+ processes:
200
+ index:
201
+ cron_enabled: Agendamento ativado
202
+ no_good_job_processes_found: Nenhum processo do GoodJob encontrado.
203
+ process: Processo
204
+ schedulers: Agendadores
205
+ started: Iniciado
206
+ title: Processos
207
+ updated: Atualizado
208
+ shared:
209
+ boolean:
210
+ 'false': Não
211
+ 'true': Sim
212
+ error: Erro
213
+ filter:
214
+ all: Tudo
215
+ all_jobs: Todas as tarefas
216
+ all_queues: Todas as filas
217
+ clear: Limpar
218
+ job_name: Nome da Tarefa
219
+ placeholder: Pesquisar por classe, ID da tarefa, parâmetros da tarefa e texto de erro.
220
+ queue_name: Nome da Fila
221
+ search: Pesquisar
222
+ navbar:
223
+ batches: Lotes
224
+ cron_schedules: Agendamentos
225
+ jobs: Tarefas
226
+ live_poll: Acompanhamento ao Vivo
227
+ name: "GoodJob 👍"
228
+ processes: Processos
229
+ theme:
230
+ auto: Automático
231
+ dark: Escuro
232
+ light: Claro
233
+ theme: Tema
234
+ secondary_navbar:
235
+ inspiration: Lembre-se, você também está fazendo uma Boa Tarefa!
236
+ last_updated: Última atualização
237
+ status:
238
+ discarded: Descartado
239
+ queued: Enfileirado
240
+ retried: Tentado novamente
241
+ running: Em execução
242
+ scheduled: Agendado
243
+ succeeded: Concluído com sucesso
@@ -96,6 +96,8 @@ module GoodJob
96
96
  # Generates the concurrency key from the configuration
97
97
  # @return [Object] concurrency key
98
98
  def _good_job_concurrency_key
99
+ return _good_job_default_concurrency_key unless self.class.good_job_concurrency_config.key?(:key)
100
+
99
101
  key = self.class.good_job_concurrency_config[:key]
100
102
  return if key.blank?
101
103
 
@@ -105,6 +107,12 @@ module GoodJob
105
107
  key
106
108
  end
107
109
 
110
+ # Generates the default concurrency key when the configuration doesn't provide one
111
+ # @return [String] concurrency key
112
+ def _good_job_default_concurrency_key
113
+ self.class.name.to_s
114
+ end
115
+
108
116
  private
109
117
 
110
118
  def good_job_enqueue_concurrency_check(job, on_abort:, on_enqueue:)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module GoodJob
4
4
  # GoodJob gem version.
5
- VERSION = '3.23.0'
5
+ VERSION = '3.24.0'
6
6
 
7
7
  # GoodJob version as Gem::Version object
8
8
  GEM_VERSION = Gem::Version.new(VERSION)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.23.0
4
+ version: 3.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -347,6 +347,7 @@ files:
347
347
  - config/locales/ja.yml
348
348
  - config/locales/ko.yml
349
349
  - config/locales/nl.yml
350
+ - config/locales/pt-BR.yml
350
351
  - config/locales/ru.yml
351
352
  - config/locales/tr.yml
352
353
  - config/locales/uk.yml
@@ -436,7 +437,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
436
437
  - !ruby/object:Gem::Version
437
438
  version: '0'
438
439
  requirements: []
439
- rubygems_version: 3.4.10
440
+ rubygems_version: 3.5.3
440
441
  signing_key:
441
442
  specification_version: 4
442
443
  summary: A multithreaded, Postgres-based ActiveJob backend for Ruby on Rails