File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,27 @@ local function tbl_copy(orig)
5050end
5151
5252
53+ -- Returns a new table, recursively copied from the one given, retaining
54+ -- metatable assignment.
55+ --
56+ -- @param table table to be copied
57+ -- @return table
58+ local function tbl_copy (orig )
59+ local orig_type = type (orig )
60+ local copy
61+ if orig_type == " table" then
62+ copy = {}
63+ for orig_key , orig_value in next , orig , nil do
64+ copy [tbl_copy (orig_key )] = tbl_copy (orig_value )
65+ end
66+ setmetatable (copy , tbl_copy (getmetatable (orig )))
67+ else -- number, string, boolean, etc
68+ copy = orig
69+ end
70+ return copy
71+ end
72+
73+
5374-- Returns a new table, recursively copied from the combination of the given
5475-- table `t1`, with any missing fields copied from `defaults`.
5576--
@@ -89,7 +110,6 @@ local DEFAULTS = setmetatable({
89110
90111 keepalive_timeout = 60000 ,
91112 keepalive_poolsize = 30 ,
92-
93113 host = " 127.0.0.1" ,
94114 port = 6379 ,
95115 path = " " , -- /tmp/redis.sock
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ location /t {
141141 assert(slaveports[" 6378" ] == false and slaveports[" 6380" ] == true,
142142 " only 6380 should be found" )
143143
144+ r: slaveof(" 127.0.0.1" , 6379 )
144145 sentinel: close()
145146 }
146147}
You can’t perform that action at this time.
0 commit comments