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

Incorrect middleware configuration in README.md #1

Open
navidemad opened this issue Aug 11, 2023 · 3 comments
Open

Incorrect middleware configuration in README.md #1

navidemad opened this issue Aug 11, 2023 · 3 comments

Comments

@navidemad
Copy link

Hello,

Firstly, I'd like to express my gratitude for your gem. It's evident that a lot of hard work has been put into it.

While setting up, I followed the instructions provided in the README.md. However, I kept encountering an error every time a job was enqueued to Sidekiq. The error mentioned a mismatch in the number of arguments. Upon further investigation, I found that the documentation mentions the use of server_middleware when it should have been client_middleware.

For reference, the Sidekiq documentation on middleware creation can be found here: https://github.com/sidekiq/sidekiq/wiki/Middleware.

I thought I'd bring this to your attention for the benefit of future users. Thanks again for your excellent work on this gem!

Warm regards,

@gstark
Copy link
Owner

gstark commented Aug 11, 2023

Hi @navidemad, thanks for the kind words on the gem.

Could you make a small Rails project to reproduce the error? It shouldn't need to be more than initializing a new repo, adding sidekiq and this gem, and an initializer. That would help significantly so that I can see your error. I created this repo, so feel free to look at that.

@navidemad
Copy link
Author

Hello, here how to reproduce it.
Just add a job like so app/workers/notify_job.rb:

class NotifyJob
  include Sidekiq::Job
  sidekiq_options queue: :default
  def perform(user_id)
    puts "NotifyJob is running with parameter #{user_id}"
  end
end

Run a redis-service, sidekiq, and a rails console in different tabs.
Then in your rails console type:

NotifyJob.perform_async(2)

Results:
Screenshot 2023-08-12 at 19 53 04

@gstark
Copy link
Owner

gstark commented Aug 13, 2023

Ah, thank you very much. I mistakenly only provided a single middleware for the client API for sidekiq. I have a new PR with middleware for the client and the server. I've also updated the README to indicate how to use each.

Please try #3 in your project

gem "newrelic_gvl", github: "gstark/newrelic_gvl", ref: "fix-api-design"

Let me know if this works for you. If so, I will cut a new release. I also look forward to any insight this provides you on NewRelic. I do not yet have a project on both Ruby 3.2 and NewRelic so I have not been able to use this code in production yet.

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

2 participants