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 am relying on the default redis_key method in the 1.2.1 version to produce a unique key when the args is the same. In my case, the args is simply a single numeric id, such as 347. Poking into the code I realized that redis_key returns "Digest::MD5.hexdigest encode(:class => job, :args => args)". The problem with this is that the encode method would return a string where sometimes the :args parameter comes first, and sometimes the :class parameter comes first:
I can only reproduce it on a staging server (but not on development). Furthermore, within the same rails console I will always get the same version back. But when I restart the console then usually I can see the other version being returned. It seems to alternate but even if not, I can usually get the other version within a few console restarts.
I am using ruby 1.8.7 and Rails 3.0.19. I can overwrite the redis_key method in my class but I wonder if this is a generic issue that should be fixed in the plugin itself. Thanks.
The text was updated successfully, but these errors were encountered:
Upon further inspection and experimentation I realized it's because ultimately we are calling the "to_json" method on the hash and since 1.8.7 doesn't guarantee the key ordering, the resulting string can look different due to a different ordering of the keys.
I am relying on the default redis_key method in the 1.2.1 version to produce a unique key when the args is the same. In my case, the args is simply a single numeric id, such as 347. Poking into the code I realized that redis_key returns "Digest::MD5.hexdigest encode(:class => job, :args => args)". The problem with this is that the encode method would return a string where sometimes the :args parameter comes first, and sometimes the :class parameter comes first:
(1) "{"args":[347],"class""AsyncCallback"}"
(2) "{"class""AsyncCallback", "args":[347]}"
I can only reproduce it on a staging server (but not on development). Furthermore, within the same rails console I will always get the same version back. But when I restart the console then usually I can see the other version being returned. It seems to alternate but even if not, I can usually get the other version within a few console restarts.
I am using ruby 1.8.7 and Rails 3.0.19. I can overwrite the redis_key method in my class but I wonder if this is a generic issue that should be fixed in the plugin itself. Thanks.
The text was updated successfully, but these errors were encountered: