misc fixes for bsky

This commit is contained in:
Dylan Knutson
2025-08-12 21:22:51 +00:00
parent ad0675a9aa
commit 171ddd430b
5 changed files with 31 additions and 15 deletions

View File

@@ -80,7 +80,7 @@ export default function ListItem({
</div>
)}
{domainIcon && (
<img src={domainIcon} alt="domain icon" className="inline w-6" />
<img src={domainIcon} alt="domain icon" className="ml-1 inline w-6" />
)}
</div>
</a>

View File

@@ -2,7 +2,7 @@
class Domain::Bluesky::Job::ScanPostsJob < Domain::Bluesky::Job::Base
MEDIA_EMBED_TYPES = %w[app.bsky.embed.images app.bsky.embed.video]
self.default_priority = -25
self.default_priority = -10
sig { override.params(args: T::Hash[Symbol, T.untyped]).returns(T.untyped) }
def perform(args)
@@ -256,13 +256,9 @@ class Domain::Bluesky::Job::ScanPostsJob < Domain::Bluesky::Job::Base
sig { params(post: Domain::Post::BlueskyPost).void }
def enqueue_pending_files_job(post)
post.files.each do |file|
if file.state_pending?
defer_job(
Domain::StaticFileJob,
{ post_file: file },
{ queue: "bluesky" },
)
post.files.each do |post_file|
if post_file.state_pending?
defer_job(Domain::StaticFileJob, { post_file: })
end
end
end
@@ -283,7 +279,7 @@ class Domain::Bluesky::Job::ScanPostsJob < Domain::Bluesky::Job::Base
set_alt_text(post_file, image_data["alt"])
post_file.save!
defer_job(Domain::StaticFileJob, { post_file: }, { queue: "bluesky" })
defer_job(Domain::StaticFileJob, { post_file: })
logger.debug(
format_tags(
@@ -307,7 +303,7 @@ class Domain::Bluesky::Job::ScanPostsJob < Domain::Bluesky::Job::Base
set_aspect_ratio(post_file, embed_data["aspectRatio"])
set_alt_text(post_file, embed_data["alt"])
post_file.save!
defer_job(Domain::StaticFileJob, { post_file: }, { queue: "bluesky" })
defer_job(Domain::StaticFileJob, { post_file: })
logger.debug(
format_tags(

View File

@@ -1,6 +1,6 @@
# typed: strict
class Domain::Bluesky::Job::ScanUserJob < Domain::Bluesky::Job::Base
self.default_priority = -30
self.default_priority = -20
sig { override.params(args: T::Hash[Symbol, T.untyped]).returns(T.untyped) }
def perform(args)
@@ -121,20 +121,24 @@ class Domain::Bluesky::Job::ScanUserJob < Domain::Bluesky::Job::Base
defer_job(
Domain::UserAvatarJob,
{ avatar: avatar },
{ queue: "bluesky" },
{ queue: "bluesky", priority: -30 },
)
elsif existing_avatar.state_pending?
defer_job(
Domain::UserAvatarJob,
{ avatar: existing_avatar },
{ queue: "bluesky" },
{ queue: "bluesky", priority: -30 },
)
logger.info(format_tags("re-enqueued pending avatar download"))
end
else
# Create new avatar and enqueue download
avatar = user.avatars.create!(url_str: avatar_url)
defer_job(Domain::UserAvatarJob, { avatar: }, { queue: "bluesky" })
defer_job(
Domain::UserAvatarJob,
{ avatar: },
{ queue: "bluesky", priority: -30 },
)
logger.info(
format_tags(
"created avatar and enqueued download",

View File

@@ -0,0 +1,15 @@
# typed: strict
# frozen_string_literal: true
class AddFirstSeenEntryToBskyPosts < ActiveRecord::Migration[7.2]
sig { void }
def change
change_table :domain_posts_bluesky_aux do |t|
t.references :first_seen_entry,
foreign_key: {
to_table: :http_log_entries,
},
index: false
end
end
end

View File

@@ -5866,6 +5866,7 @@ ALTER TABLE ONLY public.domain_twitter_tweets
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20250812211640'),
('20250812182033'),
('20250811172839'),
('20250808004604'),