5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 11:31:41 +00:00

feat: establecer prioridades para las tareas

This commit is contained in:
f 2024-02-27 16:53:48 -03:00
parent d5f48c6007
commit 34ead9ea4a
No known key found for this signature in database
6 changed files with 12 additions and 0 deletions

View file

@ -9,6 +9,8 @@
# autenticación. # autenticación.
class ActivityPub class ActivityPub
class ActorFetchJob < ApplicationJob class ActorFetchJob < ApplicationJob
self.priority = 50
def perform(site:, actor:) def perform(site:, actor:)
ActivityPub::Actor.transaction do ActivityPub::Actor.transaction do
response = site.social_inbox.dereferencer.get(uri: actor.uri) response = site.social_inbox.dereferencer.get(uri: actor.uri)

View file

@ -5,6 +5,8 @@ class ActivityPub
# actualizar el listado de instancias, bloquea las instancias en cada # actualizar el listado de instancias, bloquea las instancias en cada
# sitio que tenga el fediblock habilitado. # sitio que tenga el fediblock habilitado.
class FediblockFetchJob < ApplicationJob class FediblockFetchJob < ApplicationJob
self.priority = 50
def perform def perform
ActivityPub::Fediblock.find_each do |fediblock| ActivityPub::Fediblock.find_each do |fediblock|
fediblock.process! fediblock.process!

View file

@ -4,6 +4,8 @@
# de los fediblocks con los sitios que las tengan activadas. # de los fediblocks con los sitios que las tengan activadas.
class ActivityPub class ActivityPub
class FediblockUpdatedJob < ApplicationJob class FediblockUpdatedJob < ApplicationJob
self.priority = 50
# @param :fediblock [ActivityPub::Fediblock] # @param :fediblock [ActivityPub::Fediblock]
# @param :instances [Array<String>] # @param :instances [Array<String>]
def perform(fediblock:, hostnames:) def perform(fediblock:, hostnames:)

View file

@ -9,6 +9,8 @@
# autenticación. # autenticación.
class ActivityPub class ActivityPub
class FetchJob < ApplicationJob class FetchJob < ApplicationJob
self.priority = 50
def perform(site:, object:) def perform(site:, object:)
ActivityPub::Object.transaction do ActivityPub::Object.transaction do
return if object.activity_pubs.where(aasm_state: 'removed').count.positive? return if object.activity_pubs.where(aasm_state: 'removed').count.positive?

View file

@ -3,6 +3,8 @@
class ActivityPub class ActivityPub
# Obtiene o actualiza los datos de una instancia. # Obtiene o actualiza los datos de una instancia.
class InstanceFetchJob < ApplicationJob class InstanceFetchJob < ApplicationJob
self.priority = 100
def perform(site:, instance:) def perform(site:, instance:)
%w[/api/v2/instance /api/v1/instance].each do |api| %w[/api/v2/instance /api/v1/instance].each do |api|
uri = SocialInbox.generate_uri(instance.hostname) do |u| uri = SocialInbox.generate_uri(instance.hostname) do |u|

View file

@ -3,6 +3,8 @@
class ActivityPub class ActivityPub
# Bloquea varias instancias de una sola vez # Bloquea varias instancias de una sola vez
class InstanceModerationJob < ApplicationJob class InstanceModerationJob < ApplicationJob
self.priority = 50
# @param :site [Site] # @param :site [Site]
# @param :hostnames [Array<String>] # @param :hostnames [Array<String>]
def perform(site:, hostnames:) def perform(site:, hostnames:)