seomoz / qless-core

Core Lua Scripts for qless
MIT License
85 stars 33 forks source link

make sure the job data is passed unchanged through redis/lua #6

Closed databus23 closed 11 years ago

databus23 commented 11 years ago

If the job data JSON contains empty arrays they are mangled by the decoding to a lua table. This commit stores and returns the raw job data without processing it with lua/cjson.

This pull request belongs to seomoz/qless#73 and tries to be a fix for it.

The change to get.lua qualifies as a hack and I would be happy for alternative suggestions.

The way I see it there are only two options:

  1. Use cjson.encode to create the JSON response and squeeze in the raw job_data afterwards (my current approach).
  2. Create the whole JSON container manually without cjson which involves quite a lot of string manipulation.
dlecocq commented 11 years ago

Sorry it took me so long to get to this one :-/ I think I'll forward-port this to the unified branch. Not sure I can think of anything more elegant for get.lua at the moment, but it seems reasonable enough for the moment.

dlecocq commented 11 years ago

On second thought, I figure we can just have data returned as the string JSON blob, and then clients decode it. It results in a little more string escaping, but ultimately, I think it's cleaner.

If it's alright with you, since the unified branch has diverged so much, it'll be easier to just amend this new commit to point to you as the author?

databus23 commented 11 years ago

Sure, happy this is considered.