docs add more docs to app/{jobs,logical}.

These were missed in the last commit.
This commit is contained in:
evazion
2021-06-27 18:12:58 -05:00
parent fef5f238a5
commit ad4c75eb1a
16 changed files with 36 additions and 11 deletions

View File

@@ -73,7 +73,7 @@ Each controller action above corresponds to an URL:
| BansController#update | PUT https://danbooru.donmai.us/bans/1234 | PUT /bans/:id | | | | BansController#update | PUT https://danbooru.donmai.us/bans/1234 | PUT /bans/:id | | |
| BansController#destroy | DELETE https://danbooru.donmai.us/bans/1234 | DELETE /bans/:id | | | | BansController#destroy | DELETE https://danbooru.donmai.us/bans/1234 | DELETE /bans/:id | | |
These routes are defined in [config/routes.rb](../config/routes.rb). These routes are defined in [config/routes.rb](../../config/routes.rb).
# Authorization # Authorization

View File

@@ -1,3 +1,7 @@
# A job that exports a database table to Google Cloud Storage and to Google
# BigQuery. Spawned daily by {DanbooruMaintenance}.
#
# @see BigqueryExportService
class BigqueryExportJob < ApplicationJob class BigqueryExportJob < ApplicationJob
retry_on Exception, attempts: 0 retry_on Exception, attempts: 0

View File

@@ -1,3 +1,5 @@
# A job that sends notifications about new forum posts to Discord. Spawned by
# the {ForumPost} class when a new forum post is created.
class DiscordNotificationJob < ApplicationJob class DiscordNotificationJob < ApplicationJob
retry_on Exception, attempts: 0 retry_on Exception, attempts: 0

View File

@@ -1,3 +1,5 @@
# A job that adds a post to IQDB when a new post is uploaded, or when a post is
# regenerated. Spawned by the {Post} class.
class IqdbAddPostJob < ApplicationJob class IqdbAddPostJob < ApplicationJob
def perform(post) def perform(post)
IqdbClient.new.add_post(post) IqdbClient.new.add_post(post)

View File

@@ -1,3 +1,5 @@
# A job that removes a post from IQDB when it is deleted. Spawned by the {Post}
# class.
class IqdbRemovePostJob < ApplicationJob class IqdbRemovePostJob < ApplicationJob
def perform(post_id) def perform(post_id)
IqdbClient.new.remove(post_id) IqdbClient.new.remove(post_id)

View File

@@ -1,3 +1,5 @@
# A job that updates a user's saved searches when they do a search for
# `search:all` or `search:<label>`.
class PopulateSavedSearchJob < ApplicationJob class PopulateSavedSearchJob < ApplicationJob
queue_as :default queue_as :default

View File

@@ -1,3 +1,6 @@
# A job that processes a single tag alias or implication when a bulk update
# request is approved. One job per alias or implication is spawned. Jobs are
# processed sequentially in the `bulk_update` queue.
class ProcessTagRelationshipJob < ApplicationJob class ProcessTagRelationshipJob < ApplicationJob
queue_as :bulk_update queue_as :bulk_update
retry_on Exception, attempts: 0 retry_on Exception, attempts: 0

View File

@@ -1,5 +1,5 @@
# A job that performs a mass update or tag nuke operation in a bulk update # A job that performs a mass update or tag nuke operation in a bulk update
# request. # request. Jobs in the `bulk_update` queue are processed sequentially.
class TagBatchChangeJob < ApplicationJob class TagBatchChangeJob < ApplicationJob
queue_as :bulk_update queue_as :bulk_update

View File

@@ -1,4 +1,4 @@
# A job that tries to resume a preprocessed image upload. # A job that tries to resume a preprocessed image upload job.
class UploadServiceDelayedStartJob < ApplicationJob class UploadServiceDelayedStartJob < ApplicationJob
queue_as :default queue_as :default
queue_with_priority(-1) queue_with_priority(-1)

View File

@@ -1,3 +1,6 @@
# A concern that handles @mentions in comments and forum posts. Sends a DMail
# to mentioned users when a comment or forum post is created or edited to add
# new mentions.
module Mentionable module Mentionable
extend ActiveSupport::Concern extend ActiveSupport::Concern

View File

@@ -1,6 +1,6 @@
# A HTTP::Feature that automatically follows HTTP redirects. # A HTTP::Feature that automatically follows HTTP redirects.
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections #
# @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
module Danbooru module Danbooru
class Http class Http
class Redirector < HTTP::Feature class Redirector < HTTP::Feature

View File

@@ -1,3 +1,4 @@
# A StorageManager that stores files on the local filesystem.
class StorageManager::Local < StorageManager class StorageManager::Local < StorageManager
DEFAULT_PERMISSIONS = 0o644 DEFAULT_PERMISSIONS = 0o644

View File

@@ -1,3 +1,5 @@
# A null StorageManager that doesn't store files at all. Used for testing or
# disabling backups.
class StorageManager::Null < StorageManager class StorageManager::Null < StorageManager
def initialize(base_url: "/", base_dir: "/") def initialize(base_url: "/", base_dir: "/")
super super

View File

@@ -1,3 +1,6 @@
# The base class for emails sent by Danbooru.
#
# @see https://guides.rubyonrails.org/action_mailer_basics.html
class ApplicationMailer < ActionMailer::Base class ApplicationMailer < ActionMailer::Base
default from: "#{Danbooru.config.canonical_app_name} <#{Danbooru.config.contact_email}>", content_type: "text/html" default from: "#{Danbooru.config.canonical_app_name} <#{Danbooru.config.contact_email}>", content_type: "text/html"
end end

View File

@@ -1,5 +1,6 @@
# This file runs after config/boot.rb and before config/environment.rb. It loads Rails, loads the gems, loads the # This file runs after config/boot.rb and before config/environment.rb. It loads
# Danbooru configuration, and does some basic Rails configuration. # Rails, loads the gems, loads the Danbooru configuration, and does some basic
# Rails configuration.
# #
# @see https://guides.rubyonrails.org/initialization.html # @see https://guides.rubyonrails.org/initialization.html
@@ -21,8 +22,8 @@ require "rails/test_unit/railtie"
# Load the gems for the current Rails environment from the Gemfile. # Load the gems for the current Rails environment from the Gemfile.
Bundler.require(*Rails.groups) Bundler.require(*Rails.groups)
# Load the default Danbooru configuration from config/danbooru_default_config.rb and the custom config from # Load the default Danbooru configuration from config/danbooru_default_config.rb
# config/danbooru_local_config.rb. # and the custom config from config/danbooru_local_config.rb.
begin begin
require_relative "danbooru_default_config" require_relative "danbooru_default_config"
require_relative ENV.fetch("DANBOORU_CONFIG_FILE", "danbooru_local_config") require_relative ENV.fetch("DANBOORU_CONFIG_FILE", "danbooru_local_config")

View File

@@ -1,6 +1,6 @@
# Fixes # Fixes
This directory contains fix scripts designed to fix various problems with the production database. Most of these scripts This directory contains one-off scripts designed to fix various problems with the production database. Most of these
are for the production database and aren't meant to be run by downstream users. scripts are for the production database and aren't meant to be run by downstream users.
Most of the older scripts here no longer work because of changes to the code over the years. Most of the older scripts here no longer work because of changes to the code over the years.