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
- backup your import and move it to production