def _handle_stats_opt_in(self):

        if self.single.must_send_stats():
            logger.debug("Handling customer opt-in to sending statistics")
            manager = CreateStatsUserTaskManager()
        else:
            logger.debug("Handling customer opt-out to sending statistics")
            manager = RemoveStatsUserTaskManager()

        try:
            manager.execute()
        except Exception:
            logger.exception("Stats user operation failed")
Exemple #2
0
    def _handle_stats_opt_in(self, settings_data=None):
        """Starts task on stats user creation or removal

        :param settings_data: dict with master node settings.
        Current data from DB will be used if master_node_settings_data is None
        """
        must_send = self.single.must_send_stats(
            master_node_settings_data=settings_data)
        if must_send:
            logger.debug("Handling customer opt-in to sending statistics")
            manager = CreateStatsUserTaskManager()
        else:
            logger.debug("Handling customer opt-out to sending statistics")
            manager = RemoveStatsUserTaskManager()
        try:
            manager.execute()
        except Exception:
            logger.exception("Stats user operation failed")