-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve safety and error handling of setting shared dict data.
See 18F/api.data.gov#385 This replaces "set" calls with "safe_set" for the "active_config" shared dict to prevent the possibility of publishing new API configuration removing old API configuration when it exceeds the available memory allocated for the shared dict. We also handle the possibility of "safe_set" still unpublishing the old configuration when it exceeds the available memory, which should ensure that the full API configuration never gets unpublished. This also adds more explicit error and warning logging to all the shared dict "set" calls.
- Loading branch information
Showing
14 changed files
with
310 additions
and
44 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
local cmsgpack = require "cmsgpack" | ||
|
||
local pack = cmsgpack.pack | ||
local unpack = cmsgpack.unpack | ||
|
||
local _M = {} | ||
|
||
function _M.get_packed(dict, key) | ||
local packed = dict:get(key) | ||
if packed then | ||
return unpack(packed) | ||
end | ||
end | ||
|
||
function _M.set_packed(dict, key, value) | ||
return dict:set(key, pack(value)) | ||
end | ||
|
||
function _M.safe_set_packed(dict, key, value) | ||
return dict:safe_set(key, pack(value)) | ||
end | ||
|
||
return _M |
Oops, something went wrong.