Skip to content

Commit

Permalink
Created prod version
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Burkalev authored and Konstantin Burkalev committed Jan 31, 2019
1 parent fe74f9e commit bc061c1
Show file tree
Hide file tree
Showing 5 changed files with 204 additions and 84 deletions.
6 changes: 3 additions & 3 deletions lib/flushdb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ function _M.flushAll()

local conf = require("wiola.config").config()
local redis = require "redis"
local client = redis.connect(conf.redis.host, conf.redis.port)
local client = redis.connect(conf.storeConfig.host, conf.storeConfig.port)

if conf.redis.db then
client:select(conf.redis.db)
if conf.storeConfig.db then
client:select(conf.storeConfig.db)
end

client:flushdb()
Expand Down
6 changes: 4 additions & 2 deletions lib/msgpack_serializer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ local orig_map = mp.packers['map']
local orig_array = mp.packers['array']

mp.packers['array'] = function(buffer, tbl, n)
if type(tbl.__jsontype) == 'string' and tbl.__jsontype == 'object' then
local mt = getmetatable(tbl)
if mt~= nil and type(mt.__jsontype) == 'string' and mt.__jsontype == 'object' then
orig_map(buffer, tbl, n)
else
orig_array(buffer, tbl, n)
end
end

mp.packers['map'] = function(buffer, tbl, n)
if type(tbl.__jsontype) == 'string' and tbl.__jsontype == 'array' then
local mt = getmetatable(tbl)
if mt~= nil and type(mt.__jsontype) == 'string' and mt.__jsontype == 'array' then
orig_array(buffer, tbl, n)
else
orig_map(buffer, tbl, n)
Expand Down
Loading

0 comments on commit bc061c1

Please sign in to comment.