Skip to content

Commit

Permalink
update: add docstring.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariamjamal94 committed Sep 25, 2019
1 parent 01a8ea1 commit 498db55
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions optimizely/event/event_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ def process(self, user_event):
self.logger.debug('Payload not accepted by the queue. Current size: {}'.format(str(self.event_queue.qsize())))

def _add_to_batch(self, user_event):
""" Method to append received user event to current batch.
Args:
user_event: UserEvent Instance.
"""
if self._should_split(user_event):
self._flush_queue()
self._current_batch = list()
Expand All @@ -232,6 +236,14 @@ def _add_to_batch(self, user_event):
self._flush_queue()

def _should_split(self, user_event):
""" Method to check if current event batch should split into two.
Args:
user_event: UserEvent Instance.
Return Value:
- True, if revision number and project_id of last event in current batch do not match received event's
revision number and project id respectively.
- False, otherwise.
"""
if len(self._current_batch) == 0:
return False

Expand Down

0 comments on commit 498db55

Please sign in to comment.