Circular dependency issues when using Sidekiq and the module naming scheme

Good morning, we are having unpleasant problems using Sidekiq to process our queues. It seems that the problem is the first time we run Sidekiq (downloadable resources) in production environments.

basically we have classes separated inside modules to have a better naming scheme.

This is an example module in which a problem has occurred.

module MyApp
  module APIIntegration
    class Client          
       def driver
         @driver ||= MyApp::APIIntegration::Driver.new
       end  
    end
  end
end 

We get "A cyclic dependency was detected during startup of the constant MyApp :: APIIntegration :: Driver"

Any idea why this is happening? should we contact the driver simply by calling the driver instead of the full name? What can I try to reproduce this problem?

Any suggestion is welcome and thank you very much

+4
1

module MyApp
  module APIIntegration
    class Client          
       def driver
         @driver ||= Driver.new
       end  
    end
  end
end 
+2

Source: https://habr.com/ru/post/1534297/


All Articles