mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 06:51:41 +00:00
feat: establecer prioridades para las tareas
This commit is contained in:
parent
d5f48c6007
commit
34ead9ea4a
6 changed files with 12 additions and 0 deletions
|
@ -9,6 +9,8 @@
|
|||
# autenticación.
|
||||
class ActivityPub
|
||||
class ActorFetchJob < ApplicationJob
|
||||
self.priority = 50
|
||||
|
||||
def perform(site:, actor:)
|
||||
ActivityPub::Actor.transaction do
|
||||
response = site.social_inbox.dereferencer.get(uri: actor.uri)
|
||||
|
|
|
@ -5,6 +5,8 @@ class ActivityPub
|
|||
# actualizar el listado de instancias, bloquea las instancias en cada
|
||||
# sitio que tenga el fediblock habilitado.
|
||||
class FediblockFetchJob < ApplicationJob
|
||||
self.priority = 50
|
||||
|
||||
def perform
|
||||
ActivityPub::Fediblock.find_each do |fediblock|
|
||||
fediblock.process!
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
# de los fediblocks con los sitios que las tengan activadas.
|
||||
class ActivityPub
|
||||
class FediblockUpdatedJob < ApplicationJob
|
||||
self.priority = 50
|
||||
|
||||
# @param :fediblock [ActivityPub::Fediblock]
|
||||
# @param :instances [Array<String>]
|
||||
def perform(fediblock:, hostnames:)
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
# autenticación.
|
||||
class ActivityPub
|
||||
class FetchJob < ApplicationJob
|
||||
self.priority = 50
|
||||
|
||||
def perform(site:, object:)
|
||||
ActivityPub::Object.transaction do
|
||||
return if object.activity_pubs.where(aasm_state: 'removed').count.positive?
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class ActivityPub
|
||||
# Obtiene o actualiza los datos de una instancia.
|
||||
class InstanceFetchJob < ApplicationJob
|
||||
self.priority = 100
|
||||
|
||||
def perform(site:, instance:)
|
||||
%w[/api/v2/instance /api/v1/instance].each do |api|
|
||||
uri = SocialInbox.generate_uri(instance.hostname) do |u|
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
class ActivityPub
|
||||
# Bloquea varias instancias de una sola vez
|
||||
class InstanceModerationJob < ApplicationJob
|
||||
self.priority = 50
|
||||
|
||||
# @param :site [Site]
|
||||
# @param :hostnames [Array<String>]
|
||||
def perform(site:, hostnames:)
|
||||
|
|
Loading…
Reference in a new issue