pendant Jobs::ProcessPost
Je peux le recréer en ligne de commande :
alors que je peux y accéder avec succès par :
Je crois que cela pourrait être lié à ceci :
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`
Contient :
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
Dans ce contexte, cela pourrait-il nécessiter un :: en préfixe ?
1 « J'aime »
david
(David Taylor)
Mai 26, 2022, 11:35
2
Hmm, ajouter un :: au début le corrigerait certainement… mais ça ne devrait pas être nécessaire
Étant donné que l’appel provient de ::Jobs::ProcessPost, Ruby devrait remonter l’arbre. Il cherchera d’abord ::Jobs::ProcessPost::Jobs, puis ::Jobs::Jobs, et enfin le module ::Jobs.
L’erreur que vous voyez suggère que quelque chose définit ::Jobs::Jobs… ce qui est étrange ! En regardant sur mon instance de développement :
[1] pry(main)> Jobs::Jobs
=> Jobs::Jobs
[2] pry(main)> Jobs::Jobs.constants
=> [:RemapOldBotImages, :GrantBadges]
Il semble que ces lignes dans discourse-narrative-bot causent des problèmes. Si je les commente, cela résout le problème.
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
La bonne nouvelle est que c’est spécifique au développement - lié aux chemins de fichiers des jobs qui ne correspondent pas aux noms des modules. Voici une PR pour nettoyer cela :
main ← narritive-bot-autoload
opened 11:34AM - 26 May 22 UTC
These incorrect paths were causing the regular jobs to be loaded in a `Jobs::Job… s` module in development mode, which would cause various weird issues.
https://meta.discourse.org/t/228155
Merci pour le rapport @merefield
4 « J'aime »
Ah, oui, étrange et explique pourquoi la production n’a pas explosé !
Merci pour votre réponse rapide !!
2 « J'aime »
david
(David Taylor)
A fermé ce sujet ()
Mai 27, 2022, 7:00
4
Ce sujet a été automatiquement fermé après 17 heures. Les nouvelles réponses ne sont plus autorisées.