Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 5.0.2 release #78

Merged
merged 39 commits into from
Mar 27, 2018
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
33fb7f5
support segments
eli-darkly Jan 18, 2018
64b0051
Merge branch 'segments' into eb/segments
eli-darkly Feb 1, 2018
91cd013
genericized feature store + misc fixes
eli-darkly Feb 1, 2018
7ae9b3a
unit tests, misc cleanup
eli-darkly Feb 1, 2018
6aaa7e8
undo renaming of modules
eli-darkly Feb 1, 2018
55baede
more test coverage
eli-darkly Feb 6, 2018
983ae60
misc cleanup
eli-darkly Feb 6, 2018
21b07ba
cleaner path-parsing logic
eli-darkly Feb 6, 2018
796a1fc
InMemoryFeatureStore should implement FeatureStore
eli-darkly Feb 6, 2018
745b3b9
add more unit test coverage of flag evals
eli-darkly Feb 6, 2018
f03aaa1
fix bug in flag evals - putting wrong flag in "prereqOf"
eli-darkly Feb 6, 2018
d245ef2
use namedtuple
eli-darkly Feb 6, 2018
8fdfd40
use namedtuple again
eli-darkly Feb 6, 2018
51853eb
misc cleanup
eli-darkly Feb 7, 2018
21389b6
use defaultdict
eli-darkly Feb 7, 2018
74beca3
change class name
eli-darkly Feb 7, 2018
79376e4
Merge branch 'segments' into eb/segments
eli-darkly Feb 7, 2018
3a691f6
Merge branch 'segments' into eb/segments
eli-darkly Feb 7, 2018
7e02fa2
fix merge
eli-darkly Feb 7, 2018
1d7dd3e
Merge branch 'segments' into eb/segments
eli-darkly Feb 7, 2018
830f2d1
Merge pull request #31 from launchdarkly/eb/segments
eli-darkly Feb 13, 2018
2018a25
fix & test edge case of weight=None
eli-darkly Feb 13, 2018
1602f10
Merge pull request #36 from launchdarkly/eb/more-segment-tests
eli-darkly Feb 13, 2018
29a05b6
remove all Twisted support
eli-darkly Feb 21, 2018
35c787a
update readme: we do support streaming for Python 2.6
eli-darkly Feb 21, 2018
c380f8a
Merge pull request #37 from launchdarkly/eb/remove-twisted
eli-darkly Feb 21, 2018
4778831
Merge branch 'master' of github.com:launchdarkly/python-client
eli-darkly Feb 21, 2018
739cf75
fix ridiculous mistakes that broke the stream
eli-darkly Feb 22, 2018
dde98bd
Merge pull request #38 from launchdarkly/eb/fix-streaming
eli-darkly Feb 22, 2018
d52ab9d
fix further breakage in StreamProcessor
eli-darkly Feb 22, 2018
4d2f6c7
Merge pull request #39 from launchdarkly/eb/fix-streaming-2
eli-darkly Feb 22, 2018
fa66014
Merge branch 'master' of github.com:launchdarkly/python-client
eli-darkly Feb 22, 2018
9a73a16
fix Redis store to use optimistic locking and retry as needed
eli-darkly Mar 26, 2018
aee7606
make parameter name explicit
eli-darkly Mar 26, 2018
57255c7
narrower try block
eli-darkly Mar 26, 2018
243bf5b
use break/continue
eli-darkly Mar 26, 2018
eb17215
Merge pull request #41 from launchdarkly/eb/ch13390/redis-watch
eli-darkly Mar 26, 2018
8071ace
add debug logging for out-of-order update
eli-darkly Mar 26, 2018
8ed91ab
Merge pull request #43 from launchdarkly/eb/redis-debug-log
eli-darkly Mar 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleaner path-parsing logic
eli-darkly committed Feb 6, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 21b07ba944e90a0ee89675d43c93b887fbe2716b
34 changes: 19 additions & 15 deletions ldclient/streaming.py
Original file line number Diff line number Diff line change
@@ -100,17 +100,19 @@ def process_message(store, requester, msg):
path = payload['path']
obj = payload['data']
log.debug("Received patch event for %s, New version: [%d]", path, obj.get("version"))
for kind in [FEATURES, SEGMENTS]:
key = _get_key_from_path(kind, path)
if key:
store.upsert(kind, obj)
target = _parse_path(path)
if target:
store.upsert(target[0], obj)
else:
log.warning("Patch for unknown path: %s", path)
elif msg.event == "indirect/patch":
path = msg.data
log.debug("Received indirect/patch event for %s", path)
for kind in [FEATURES, SEGMENTS]:
key = _get_key_from_path(kind, path)
if key:
store.upsert(kind, requester.get_one(kind, key))
target = _parse_path(path)
if target:
store.upsert(target[0], requester.get_one(target[0], target[1]))
else:
log.warning("Indirect patch for unknown path: %s", path)
elif msg.event == "indirect/put":
log.debug("Received indirect/put event")
store.init(requester.get_all_data())
@@ -121,15 +123,17 @@ def process_message(store, requester, msg):
# noinspection PyShadowingNames
version = payload['version']
log.debug("Received delete event for %s, New version: [%d]", path, version)
for kind in [FEATURES, SEGMENTS]:
key = _get_key_from_path(kind, path)
if key:
store.delete(kind, key, version)
target = _parse_path(path)
if target:
store.delete(target[0], target[1], version)
else:
log.warning("Delete for unknown path: %s", path)
else:
log.warning('Unhandled event in stream processor: ' + msg.event)
return False

def _get_key_from_path(self, kind, path):
if path.startsWith(kind.stream_api_path):
return path.substring(len(kind.stream_api_path))
def _parse_path(self, path):
for kind in [FEATURES, SEGMENTS]:
if path.startsWith(kind.stream_api_path):
return (kind, path.substring(len(kind.stream_api_path)))
return None