diff --git a/moesifdjango/job_scheduler.py b/moesifdjango/job_scheduler.py index 89743c9..af3fb14 100644 --- a/moesifdjango/job_scheduler.py +++ b/moesifdjango/job_scheduler.py @@ -49,7 +49,7 @@ def fetch_app_config(self, config, config_etag, sampling_percentage, last_update def batch_events(self, api_client, moesif_events_queue, debug, batch_size): - + print("Starting batch events job") batch_events = [] try: while not moesif_events_queue.empty(): @@ -58,10 +58,16 @@ def batch_events(self, api_client, moesif_events_queue, debug, batch_size): break if batch_events: + req_time = batch_events[0].request.time + req_time = datetime.strptime(req_time, '%Y-%m-%dT%H:%M:%S.%f') batch_response_config_etag, batch_response_rules_etag = self.send_events(api_client, batch_events, debug) batch_events[:] = [] # Set the last time event job ran after sending events - return batch_response_config_etag, batch_response_rules_etag, datetime.utcnow() + batch_send_time = datetime.utcnow() + delta = batch_send_time - req_time + if debug and delta.total_seconds() > 0: + print("Warning: It took %s seconds to send events to Moesif. req.time=%s now=%s"%(delta.total_seconds(), req_time, batch_send_time)) + return batch_response_config_etag, batch_response_rules_etag, batch_send_time else: if debug: print("No events to send") diff --git a/setup.py b/setup.py index 776813f..ec0e59d 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='2.3.2', + version='2.3.3', description='Moesif Middleware for Python Django', long_description=long_description,