Beispiel #1
0
 def bulk_check_dialer_status(self):
     """
     Method that finds messages that are not in the final state and updates their states.
     """
     messages_to_check = self.model.objects.filter(
         is_final_state=False,
         backend=fullname(self),
         created_at__gte=now() -
         timedelta(minutes=settings.DIALER_IDLE_MESSAGES_TIMEOUT_MINUTES),
     )
     if messages_to_check.exists():
         self._update_dialer_states(messages_to_check)
Beispiel #2
0
 def _update_message(self, message, extra_sender_data=None, **kwargs):
     """
     Method for updating state of the message
     :param message: message object
     :param extra_sender_data: extra data that will be saved to the extra_sender_data field
     :param kwargs: changed object kwargs
     """
     extra_sender_data = {
         **self._get_extra_sender_data(),
         **({} if extra_sender_data is None else extra_sender_data)
     }
     message.change_and_save(backend=fullname(self),
                             extra_sender_data=extra_sender_data,
                             **kwargs)