durante Jobs::ProcessPost
Puedo recrearlo en la línea de comandos:
mientras que puedo alcanzarlo con éxito mediante:
Creo que podría estar relacionado con esto:
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`
Contiene:
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
En este contexto, ¿podría requerir un :: inicial?
1 me gusta
david
(David Taylor)
26 Mayo, 2022 11:35
2
Hmm, añadir un :: inicial ciertamente lo arreglaría… pero no debería ser necesario
Dado que la llamada proviene de ::Jobs::ProcessPost, Ruby debería buscar en el árbol. Primero buscará ::Jobs::ProcessPost::Jobs, luego ::Jobs::Jobs, y finalmente el módulo ::Jobs.
El error que estás viendo sugiere que algo está definiendo ::Jobs::Jobs… ¡lo cual es extraño! Echando un vistazo en mi instancia de desarrollo:
[1] pry(main)> Jobs::Jobs
=> Jobs::Jobs
[2] pry(main)> Jobs::Jobs.constants
=> [:RemapOldBotImages, :GrantBadges]
Parece que estas líneas en discourse-narrative-bot están causando problemas. Si las comento, se soluciona el problema.
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 buena noticia es que es solo para desarrollo, relacionado con las rutas de los archivos de los trabajos que no coinciden con los nombres de los módulos. Aquí hay una PR para limpiar las cosas:
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
Gracias por el informe @merefield
4 Me gusta
Ah, sí, ¡qué raro y explica por qué Producción no explotó!
¡Gracias por tu rápida respuesta!
2 Me gusta
david
(David Taylor)
Cerrado
27 Mayo, 2022 07:00
4
Este tema se cerró automáticamente después de 17 horas. Ya no se permiten nuevas respuestas.