You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a strange problem when using Sidekiq (https://github.com/mperham/sidekiq) with my rails app. I have a model which connects to a remote mysql db to load some csv data into a table using connection_ninja (https://github.com/cherring/connection_ninja). In my worker class i call the model method that loads the data and that works fine. But if i create a subworker inside my main worker, then the subworker is unable to execute the model method. Example.
Below is my model class
classMyModelClass < ActiveRecord::Base@conn=use_connection_ninja(:some_db)self.table_name='SomeTable'attr_accessible:name,:state,:country,:employeeIddefself.update(file_path)sql="LOAD DATA LOCAL INFILE '#{file_path}' INTO TABLE SomeTable FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' (name,state,country,employeeId)"@conn.connection().execute(sql)endend
If i have the following code in my worker everything works fine
But if create another worker class and call that from AWorker then the sidekiq job for ASubWorker is stuck on Busy
classAWorkerincludeSidekiq::Workersidekiq_options:queue=>:first,:retry=>falsedefperform(uploaded_file_path)ASubWorker.perform_async(uploaded_file_path)#Does not workendendclassASubWorkerincludeSidekiq::Workersidekiq_options:queue=>:first,:retry=>falsedefperform(result_file_path)MyModelClass.update(result_file_path)endend
The text was updated successfully, but these errors were encountered:
I ran into this same issue, which worker needs to be wrapped in an with_connection call? The perform functionality of the calling worker, or the perform method of the called worker?
I noticed a strange problem when using Sidekiq (https://github.com/mperham/sidekiq) with my rails app. I have a model which connects to a remote mysql db to load some csv data into a table using connection_ninja (https://github.com/cherring/connection_ninja). In my worker class i call the model method that loads the data and that works fine. But if i create a subworker inside my main worker, then the subworker is unable to execute the model method. Example.
Below is my model class
If i have the following code in my worker everything works fine
But if create another worker class and call that from AWorker then the sidekiq job for ASubWorker is stuck on Busy
The text was updated successfully, but these errors were encountered: