Pergunta

We are looking to migrate from delayed_job to resque for our site, and one of the caveats I am seeing all over is that while delayed_job used yaml for serialization, resque uses json, and because of this the hash keys and etc which are symbols need to be accessed as strings, since symbols cannot be stored in json(e.g source).

My question is, if this is true, was there a reason for picking json over yaml? Or rather is there any advantage that json offers for this situation?

Foi útil?

Solução

There are some JSON support by using redis hashes but I never used it and I doubt it's any useful in this case.

Resque probably uses JSON instead of YAML because it's more broad. I also found a comment on this issue about that.

@defunkt

YAML does not preserve Ruby objects better - with complicated objects it can serialize an object that it can't unserialize later. This is unacceptable.

If you want symbol keys I believe YAJL has an option we could use to preserve the keys. Also you could trivially call symbolize_keys on an object if you have ActiveSupport.

https://github.com/resque/resque/issues/26

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top