Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downgrade to 1.27 needed what should i change #1805

Open
Bodata opened this issue Jun 15, 2022 · 4 comments
Open

Downgrade to 1.27 needed what should i change #1805

Bodata opened this issue Jun 15, 2022 · 4 comments

Comments

@Bodata
Copy link

Bodata commented Jun 15, 2022

My site is still using resque 1.26.0 on my production machine.
I have updated the ruby and rails version in development.

Now the development is using version 2.2.x
The background tasks are loaded in development but it seems the class is not defined.
I downgraded from 2.2.x to 1.27 now it is working again.

What should i do to get 2.2.x working ?
It seems there has been a big change between 1.27 en 2.0 but i cannot find any documentation how to update my code.
For instance my code is in /app/workers but i see /app/jobs also been used.

@PatrickTulskie
Copy link
Contributor

Do you have any more specific errors or stack traces? Upgrading to 2.0 has worked fine on other projects without any other changes.

@Bodata
Copy link
Author

Bodata commented Mar 2, 2023

hi,

This question is quite old. I had to look into the problem again.
It still exisits for me.
At the moment in de Gemfile i have

gem "resque", '~> 1.26'

If i load the worker with

RAILS_ENV=development  QUEUE=rabbit_wachtrij rake resque:work -v

The worker loads and sends the data. I see the data that are printed out bij de worker.

The code for the worker is below

class RabbitMQ
  queue = :rabbit_wachtrij

  def self.perform( data, dest )

    if Rails.env.production?
    else
    end
    puts data
    puts dest

    STDOUT.sync = true
    conn = Bunny.new(host: "`xxxxx", user: "xxx", password: "xxx",automatically_recover: false)
    conn.start
    channel = conn.create_channel
    queue = channel.queue(dest)
    channel.default_exchange.publish(data, routing_key: queue.name)
    conn.close
  end
end

When i change the gemfile

gem "resque"

it installs versie 2.5.0

When i restart the worker

RAILS_ENV=development  QUEUE=rabbit_wachtrij rake resque:work -v

There is no output anymore when i send a message.
When i look into the resque overview i see a failed job.

Exception
    NameError
Error
    [uninitialized constant RabbitMQ](/resque/failed#)

    .rvm/gems/ruby-2.6.6/gems/resque-2.5.0/lib/resque.rb:98:in `block in constantize'
    .rvm/gems/ruby-2.6.6/gems/resque-2.5.0/lib/resque.rb:92:in `each'
    .rvm/gems/ruby-2.6.6/gems/resque-2.5.0/lib/resque.rb:92:in `constantize'

Hope this helps

Regards,
Peter

@nevans
Copy link
Contributor

nevans commented Mar 24, 2023

Does your resque:work rake task depend on the rails environment task? If not, that's the problem. See https://github.com/resque/resque#rails for an example.

If you do have that dependency, perhaps rails environment isn't finding that job correctly. That's a rails configuration issue, completely out of resque's control. Check that the constant is accessible from bin/rails console. Check that the following command returns a long array of symbols: `bin/rails runner "p RabbitMQ.methods". If either of those can't find the constant, see the config and troubleshooting guide here: https://guides.rubyonrails.org/autoloading_and_reloading_constants.html

@PatrickTulskie
Copy link
Contributor

I will add that I just upgraded 2 other projects this week from 1.27 to 2.5.0 and other than needing redis gem updates, everything just worked. Definitely seems like maybe there is something else going on with this app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants