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

Force MultiJson to NOT symbolize keys #697

Merged
merged 1 commit into from
Feb 9, 2013
Merged

Force MultiJson to NOT symbolize keys #697

merged 1 commit into from
Feb 9, 2013

Conversation

PetrKaleta
Copy link

Your load_json method must use your explicit MultiJson decoder options, in your case :symbolize_keys => false (you're using string keys)

Point is, that if you don't do it, then your gem will not work as expected. For example in your sinatra monitoring app, your slim templates are using msg['class'], msg['args] etc... but if in project where sidekiq is required will be global MultiJson configuration or global configuration for particular JSON gem, like:

Oj.default_options = {
  :symbol_keys      => true,
  :mode             => :compat,
  :time_format      => :xmlschema,
  :second_precision => 0
}

Your gem will not work at all. So you'll see empty queues http://cl.ly/image/0X2q1S232q1B and workers will not work at all as well, simply they are expecting 'string' keys...

mperham added a commit that referenced this pull request Feb 9, 2013
Force MultiJson to NOT symbolize keys
@mperham mperham merged commit ac094fc into sidekiq:master Feb 9, 2013
@Curter29
Copy link

In other hand when you pass to workers json how args {:limit => 100}, when task is run you have {'limit' => 100}, and you expect use args[:limit] but now it's accessed by args['limit']

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

Successfully merging this pull request may close these issues.

3 participants