Skip to content

Commit

Permalink
feat(cluster) use safe_set for shm
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Oct 21, 2016
1 parent 61571d5 commit 3125e4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/resty/cassandra/cluster.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ local function set_peer(self, host, up, reconn_delay, unhealthy_at,
release_version = release_version or ''

-- host status
local ok, err = self.shm:set(host, up)
local ok, err = self.shm:safe_set(host, up)
if not ok then
return nil, 'could not set host details in shm: '..err
end
Expand All @@ -72,7 +72,7 @@ local function set_peer(self, host, up, reconn_delay, unhealthy_at,
rec_peer_cdata.data_center = ffi_cast(str_const, data_center)
rec_peer_cdata.release_version = ffi_cast(str_const, release_version)

ok, err = self.shm:set(_rec_key..host, ffi_str(rec_peer_cdata, rec_peer_size))
ok, err = self.shm:safe_set(_rec_key..host, ffi_str(rec_peer_cdata, rec_peer_size))
if not ok then
return nil, 'could not set host details in shm: '..err
end
Expand Down Expand Up @@ -507,7 +507,7 @@ function _Cluster:refresh()
peers, err = get_peers(self)
if err then return nil, err end

local ok, err = self.shm:set(_protocol_version_key, coordinator.protocol_version)
local ok, err = self.shm:safe_set(_protocol_version_key, coordinator.protocol_version)
if not ok then return nil, 'could not set protocol_version in shm: '..err end
end

Expand Down

0 comments on commit 3125e4c

Please sign in to comment.