Merge commit 'f826a95f6e
' into kb_migration
This commit is contained in:
commit
4b65740722
211 changed files with 628 additions and 599 deletions
|
@ -4,6 +4,8 @@ module ApplicationExtension
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
has_many :created_users, class_name: 'User', foreign_key: 'created_by_application_id', inverse_of: :created_by_application
|
||||
|
||||
validates :name, length: { maximum: 60 }
|
||||
validates :website, url: true, length: { maximum: 2_000 }, if: :website?
|
||||
validates :redirect_uri, length: { maximum: 2_000 }
|
||||
|
|
|
@ -124,6 +124,7 @@ class LinkDetailsExtractor
|
|||
author_url: author_url || '',
|
||||
embed_url: embed_url || '',
|
||||
language: language,
|
||||
created_at: published_at.presence || Time.now.utc,
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -159,6 +160,10 @@ class LinkDetailsExtractor
|
|||
html_entities.decode(structured_data&.description || opengraph_tag('og:description') || meta_tag('description'))
|
||||
end
|
||||
|
||||
def published_at
|
||||
structured_data&.date_published || opengraph_tag('article:published_time')
|
||||
end
|
||||
|
||||
def image
|
||||
valid_url_or_nil(opengraph_tag('og:image'))
|
||||
end
|
||||
|
|
|
@ -284,11 +284,11 @@ class Request
|
|||
end
|
||||
|
||||
until socks.empty?
|
||||
_, available_socks, = IO.select(nil, socks, nil, Request::TIMEOUT[:connect])
|
||||
_, available_socks, = IO.select(nil, socks, nil, Request::TIMEOUT[:connect_timeout])
|
||||
|
||||
if available_socks.nil?
|
||||
socks.each(&:close)
|
||||
raise HTTP::TimeoutError, "Connect timed out after #{Request::TIMEOUT[:connect]} seconds"
|
||||
raise HTTP::TimeoutError, "Connect timed out after #{Request::TIMEOUT[:connect_timeout]} seconds"
|
||||
end
|
||||
|
||||
available_socks.each do |sock|
|
||||
|
|
10
app/lib/vacuum/applications_vacuum.rb
Normal file
10
app/lib/vacuum/applications_vacuum.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Vacuum::ApplicationsVacuum
|
||||
def perform
|
||||
Doorkeeper::Application.where(owner_id: nil)
|
||||
.where.missing(:created_users, :access_tokens, :access_grants)
|
||||
.where(created_at: ...1.day.ago)
|
||||
.in_batches.delete_all
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue