diff --git a/request-management-api/request_api/services/events/cfrdate.py b/request-management-api/request_api/services/events/cfrdate.py index 7f353b710..82f5a9182 100644 --- a/request-management-api/request_api/services/events/cfrdate.py +++ b/request-management-api/request_api/services/events/cfrdate.py @@ -16,6 +16,7 @@ import os from flask import current_app from dateutil.parser import parse +import time as t class cfrdateevent(duecalculator): """ FOI Event management service @@ -24,9 +25,17 @@ class cfrdateevent(duecalculator): def createdueevent(self): try: _today = self.gettoday() - notificationservice().dismissremindernotification("ministryrequest", self.__notificationtype()) + time = t.time() + notificationservice().dismissremindernotification("ministryrequest", self.__notificationtype()) + dismissremindernotification_time = t.time() + print("dismissremindernotification_time: %s" % (dismissremindernotification_time - time)) + ca_holidays = self.getholidays() + time = t.time() _upcomingdues = FOIMinistryRequest.getupcomingcfrduerecords() + getupcomingcfrduerecords_time = t.time() + print("getupcomingcfrduerecords_time: %s" % (getupcomingcfrduerecords_time - time)) + for entry in _upcomingdues: _duedate = self.formatduedate(entry['cfrduedate']) message = None @@ -34,8 +43,11 @@ def createdueevent(self): message = self.__todayduemessage() elif self.getpreviousbusinessday(entry['cfrduedate'],ca_holidays) == _today: message = self.__upcomingduemessage(_duedate) + createnotification_time = t.time() self.__createnotification(message,entry['foiministryrequestid']) self.__createcomment(entry, message) + createnotification_time = t.time() - createnotification_time + print("createnotification_time: %s" % createnotification_time) return DefaultMethodResult(True,'CFR reminder notifications created',_today) except BusinessException as exception: current_app.logger.error("%s,%s" % ('CFR reminder Notification Error', exception.message)) diff --git a/request-management-api/request_api/services/events/legislativedate.py b/request-management-api/request_api/services/events/legislativedate.py index 41ab4669f..c459a1c7b 100644 --- a/request-management-api/request_api/services/events/legislativedate.py +++ b/request-management-api/request_api/services/events/legislativedate.py @@ -16,6 +16,7 @@ import os from flask import current_app from dateutil.parser import parse +import time as t class legislativedateevent(duecalculator): """ FOI Event management service @@ -35,8 +36,14 @@ def createdueevent(self): message = self.__todayduemessage() elif self.getpreviousbusinessday(entry['duedate'],ca_holidays) == _today or self.getbusinessdaysbetween(entry['duedate'],_today) == 5: message = self.__upcomingduemessage(_duedate) + createnotification_time = t.time() self.__createnotification(message,entry['foiministryrequestid']) + createnotification_time = t.time() - createnotification_time + print("createnotification_time: %s" % createnotification_time) + createcomment_time = t.time() self.__createcomment(entry, message) + createcomment_time = t.time() - createcomment_time + print("createcomment_time: %s" % createcomment_time) return DefaultMethodResult(True,'Legislative reminder notifications created',_today) except BusinessException as exception: current_app.logger.error("%s,%s" % ('Legislative reminder Notification Error', exception.message))