Skip to content

Commit

Permalink
prepare 5.0.1 release (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Feb 22, 2018
1 parent c8f50c2 commit 063fc23
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ldclient/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ 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"))
target = _parse_path(path)
target = StreamingUpdateProcessor._parse_path(path)
if target is not None:
store.upsert(target.kind, 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)
target = _parse_path(path)
target = StreamingUpdateProcessor._parse_path(path)
if target is not None:
store.upsert(target.kind, requester.get_one(target.kind, target.key))
else:
Expand All @@ -126,7 +126,7 @@ def process_message(store, requester, msg):
# noinspection PyShadowingNames
version = payload['version']
log.debug("Received delete event for %s, New version: [%d]", path, version)
target = _parse_path(path)
target = StreamingUpdateProcessor._parse_path(path)
if target is not None:
store.delete(target.kind, target.key, version)
else:
Expand All @@ -135,8 +135,9 @@ def process_message(store, requester, msg):
log.warning('Unhandled event in stream processor: ' + msg.event)
return False

def _parse_path(self, path):
@staticmethod
def _parse_path(path):
for kind in [FEATURES, SEGMENTS]:
if path.startsWith(kind.stream_api_path):
return ParsedPath(kind = kind, key = path.substring(len(kind.stream_api_path)))
if path.startswith(kind.stream_api_path):
return ParsedPath(kind = kind, key = path[len(kind.stream_api_path):])
return None

0 comments on commit 063fc23

Please sign in to comment.