async_env.lua 541 B

12345678910111213141516171819
  1. engine.log("info","Initializing Asynchronous environment")
  2. dofile(SCRIPTDIR .. DIR_DELIM .. "misc_helpers.lua")
  3. function engine.job_processor(serialized_function, serialized_data)
  4. local fct = marshal.decode(serialized_function)
  5. local params = marshal.decode(serialized_data)
  6. local retval = marshal.encode(nil)
  7. if fct ~= nil and type(fct) == "function" then
  8. local result = fct(params)
  9. retval = marshal.encode(result)
  10. else
  11. engine.log("error","ASYNC WORKER: unable to deserialize function")
  12. end
  13. return retval,retval:len()
  14. end