The discussion revolves around images being tombstoned after an import in Discourse. pfaffman notes that images are moved to tombstone and must be recovered using rake uploads:recover_from_tombstone, but wants to prevent this issue. zogstrip explains that images are tombstoned when orphaned—i.e., not linked in the database—because the CookedPostProcessor background job, which links images to posts, only runs when Sidekiq is active. Since Sidekiq is typically not running during imports for performance reasons, the links are never created. zogstrip recommends running the import without Sidekiq, then starting Sidekiq afterward to process posts and link images, thus avoiding tombstoning. pfaffman acknowledges the solution and thanks zogstrip for the clarification.
Images are tombstoned iif they’re orphaned (ie. not linked anywhere in the application).
(Wow, that sentence is very sad…)
Images are linked to posts in the CookedPostProcessor class which is run in a background job after a post is saved.
This jobs requires sidekiq to be running but since it’s almost never the case in imports for performance reasons, the link is never stored in the database.
What @gerhard advised is the proper way of fixing this issue
run the import with sidekiq not running
once the import is done, launch sidekiq and wait for it to finish post processing all the posts
I see, and those things get queued up when the importer runs, and if you back up and restore elsewhere that doesn’t happen. And it’s taken me only a year and several dozen imports to figure that out!