From dc53d39c45f9e08007c0654e20536791b282e7a7 Mon Sep 17 00:00:00 2001 From: Owais Akbani Date: Thu, 3 Oct 2019 16:15:11 +0500 Subject: [PATCH] fix: Allow floating values less than 1 and wait only for 50ms --- optimizely/event/event_processor.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/optimizely/event/event_processor.py b/optimizely/event/event_processor.py index 22260383..954155b8 100644 --- a/optimizely/event/event_processor.py +++ b/optimizely/event/event_processor.py @@ -117,11 +117,11 @@ def _validate_intantiation_props(self, prop, prop_name): prop_name: Property name. Returns: - False if property value is None or less than 1 or not a finite number. + False if property value is None or less than or equal to 0 or not a finite number. False if property name is batch_size and value is a floating point number. True otherwise. """ - if (prop_name == 'batch_size' and not isinstance(prop, int)) or prop is None or prop < 1 or \ + if (prop_name == 'batch_size' and not isinstance(prop, int)) or prop is None or prop <= 0 or \ not validator.is_finite_number(prop): self.logger.info('Using default value for {}.'.format(prop_name)) return False @@ -159,11 +159,11 @@ def _run(self): """ try: while True: - if self._get_time() > self.flushing_interval_deadline: + if self._get_time() >= self.flushing_interval_deadline: self._flush_queue() try: - item = self.event_queue.get(True, 0.05) + item = self.event_queue.get(False) except queue.Empty: time.sleep(0.05)