during Jobs::ProcessPost
I can recreate on command line:
whereas I can successfully reach it by:
Believe it might be related to this:
https://github.com/discourse/discourse/commit/bf6f8299a781922737fa01c408078f4c090885b6
Contains:
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
In this context, could it require a leading ::?
david
(David Taylor)
26 במאי, 2022, 11:35am
2
Hmm, adding a leading :: would certainly fix it… but it shouldn’t be required
Given that the call comes from within ::Jobs::ProcessPost, Ruby should work up the tree. First it’ll look for ::Jobs::ProcessPost::Jobs, then ::Jobs::Jobs, then eventually ::Jobs module.
The error you’re seeing suggests that something is defining ::Jobs::Jobs… which is weird! Taking a look on my development instance:
[1] pry(main)> Jobs::Jobs
=> Jobs::Jobs
[2] pry(main)> Jobs::Jobs.constants
=> [:RemapOldBotImages, :GrantBadges]
Looks like these lines in discourse-narrative-bot are causing issues. If I comment them out, it solves the problem.
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
Good news is that it’s development-only - related to the file paths of the jobs mismatching the names of the modules. Here’s a PR to clean things up:
https://github.com/discourse/discourse/pull/16924
Thanks for the report @merefield
merefield
(Robert)
26 במאי, 2022, 11:41am
3
Ah, yes, weird and explains why Production didn’t blow up!
Thanks for speedy response!!