Skip to content

Commit

Permalink
fix: Avoid JSON dump on Rails.application (#6198)
Browse files Browse the repository at this point in the history
Rails enhances `Object` with `#as_json` that either uses `#to_hash`, or
builds Hash of instance variables to their values. During boot process
Sidekiq sends debug event with context that includes `:reloader`. As
Reloader class has `@app = Rails.application` that causes stak level too
deep one-off failure.
  • Loading branch information
ixti committed Feb 15, 2024
1 parent 1df02c8 commit bccc8c2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sidekiq/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def call
def inspect
"#<Sidekiq::Rails::Reloader @app=#{@app.class.name}>"
end

def to_hash
{ app: @app.class.name }
end
end

# By including the Options module, we allow AJs to directly control sidekiq features
Expand Down

0 comments on commit bccc8c2

Please sign in to comment.