Last active
April 13, 2020 02:53
-
-
Save leandromoreira/d34e256025709030d3ac773b578be0b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- fetch --- | |
local resp, err = redis_client:smembers("coding_units") | |
local raw_coding_units = {} | |
for _, coding_unit_key in ipairs(resp) do | |
local resp, err = redis_client:get(coding_unit_key) -- it'd be nice to keep the id for logging reasons | |
table.insert(raw_coding_units, resp) | |
end | |
--- fetch --- | |
--- parse --- | |
local coding_units = {} | |
for _, raw_coding_unit in ipairs(raw_coding_units) do | |
local parts = mysplit(raw_coding_unit, "||") | |
local cu = {} | |
cu['phase'] = parts[1] | |
cu['code'] = parts[2] | |
table.insert(coding_units, cu) | |
end | |
--- parse --- | |
--- execute --- | |
for _, coding_unit in ipairs(coding_units) do | |
if coding_unit['phase'] == 'current_phase' then | |
--- error checking omited --- | |
local function_code, err = loadstring(coding_unit['code']) | |
local status, ret = xpcall(function_code, err_handler) | |
end | |
end | |
--- execute --- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment