mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 10:56:22 +00:00
6e56778768
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
`touch` no corre `before_save`, con lo que el token nunca se renovaba
17 lines
646 B
Ruby
17 lines
646 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Renueva los tokens de Distributed Press antes que se venzan,
|
|
# activando los callbacks que hacen que se refresque el token.
|
|
class RenewDistributedPressTokensJob < ApplicationJob
|
|
# Renueva todos los tokens a punto de vencer o informa el error sin
|
|
# detener la tarea si algo pasa.
|
|
def perform
|
|
DistributedPressPublisher.with_about_to_expire_tokens.find_each do |publisher|
|
|
publisher.save
|
|
rescue DistributedPress::V1::Error => e
|
|
data = { instance: publisher.instance, expires_at: publisher.client.token.expires_at }
|
|
|
|
ExceptionNotifier.notify_exception(e, data: data)
|
|
end
|
|
end
|
|
end
|