أثناء Jobs::ProcessPost
يمكنني إعادة الإنشاء على سطر الأوامر:
بينما يمكنني الوصول إليه بنجاح عن طريق:
أعتقد أنه قد يكون مرتبطًا بهذا:
committed 01:28PM - 23 May 22 UTC
Previously, with the default `editing_grace_period`, hotlinked images were pulle… d 5 minutes after a post is created. This delay was added to reduce the chance of automated edits clashing with user edits.
This commit refactors things so that we can pull hotlinked images immediately. URLs are immediately updated in the post's `cooked` HTML. The post's raw markdown is updated later, after the `editing_grace_period`.
This involves a number of behind-the-scenes changes including:
- Schedule Jobs::PullHotlinkedImages immediately after Jobs::ProcessPost. Move scheduling to after the `update_column` call to avoid race conditions
- Move raw changes into a separate job, which is delayed until after the ninja-edit window
- Move disable_if_low_on_disk_space logic into the `pull_hotlinked_images` job
- Move raw-parsing/replacing logic into `InlineUpload` so it can be easily be shared between `UpdateHotlinkedRaw` and `PullUserProfileHotlinkedImages`
يحتوي على:
end
end
# onebox may have added some links, so extract them now
def extract_links(post)
TopicLink.extract_from(post)
QuotedPost.extract_from(post)
end
def enqueue_pull_hotlinked_images(post)
Jobs.cancel_scheduled_job(:pull_hotlinked_images, post_id: post.id)
Jobs.enqueue(:pull_hotlinked_images, post_id: post.id)
end
end
end
في هذا السياق، هل يمكن أن يتطلب :: بادئة؟
إعجاب واحد (1)
david
(David Taylor)
26 مايو 2022، 11:35ص
2
حسنًا، إضافة :: في البداية ستصلح الأمر بالتأكيد… ولكن لا ينبغي أن تكون مطلوبة
نظرًا لأن الاستدعاء يأتي من داخل ::Jobs::ProcessPost، يجب أن تعمل Ruby على الشجرة. أولاً ستبحث عن ::Jobs::ProcessPost::Jobs، ثم ::Jobs::Jobs، وأخيرًا عن الوحدة ::Jobs.
الخطأ الذي تراه يشير إلى أن شيئًا ما يحدد ::Jobs::Jobs… وهذا غريب! بالنظر إلى مثيل التطوير الخاص بي:
[1] pry(main)> Jobs::Jobs
=> Jobs::Jobs
[2] pry(main)> Jobs::Jobs.constants
=> [:RemapOldBotImages, :GrantBadges]
يبدو أن هذه الأسطر في discourse-narrative-bot تسبب مشاكل. إذا قمت بالتعليق عليها، فإنها تحل المشكلة.
if Rails.env == "development"
# workaround, teach reloader to reload jobs
# if we do not do this then
#
# 1. on reload rails goes and undefines Jobs::Base
# 2. as a side effect this undefines Jobs::BotInput
# 3. we have a post_edited hook that queues a job for bot input
# 4. if you are not running sidekiq in dev every time you save a post it will trigger it
# 5. but the constant can not be autoloaded
Rails.configuration.autoload_paths << File.expand_path('../autoload', __FILE__)
end
الخبر السار هو أن هذا خاص بالتطوير فقط - يتعلق بمسارات ملفات الوظائف التي لا تتطابق مع أسماء الوحدات. إليك طلب سحب لتنظيف الأمور:
https://github.com/discourse/discourse/pull/16924
شكرًا على التقرير @merefield
4 إعجابات
أجل، هذا غريب ويفسر سبب عدم انفجار الإنتاج!
شكراً على الرد السريع!!
إعجابَين (2)
david
(David Taylor)
تم إغلاقه في
27 مايو 2022، 7:00ص
4
تم إغلاق هذا الموضوع تلقائيًا بعد 17 ساعة. لم يعد يُسمح بالردود الجديدة.