My code triggers two Sidekiq jobs called ExcelImportReconcileWorker with different arguments. The worker creates a new instance of a Parsers::ExcelImport class and runs a method in it. Every time after I restart the Sidekiq, one job fails with LoadError: Unable to autoload constant Parsers::ExcelImport
, but the other one runs fine.
I had the Parsers::ExcelImport class defined with:
class Parsers::ExcelImport
...
end
and changed it to:
module Parsers
class ExcelImport
...
end
end
after reading LoadError: Unable to autoload constant with dependency although it suggests to do the opposite, but it had no change in the behavior.
Feels dump to catch a LoadError to retry the worker job. Does anyone have a better suggestion?