def update_analytics(self):
        old_a_name = set(self.subs.keys())
        new_a_name = set(self.conf_db.smembers('Analytics:Active'))

        add_a_name = new_a_name - old_a_name
        for a_name in add_a_name:
            self.create_worker(a_name)

        rem_a_name = old_a_name - new_a_name
        for a_name in rem_a_name:
            self.destroy_worker(a_name)

        for a_name in old_a_name & new_a_name:
            old_subs = self.subs[a_name].channels
            new_subs = self.conf_db.smembers(
                "Analytics:ByName:%s:Subscriptions" % a_name
            )
            add_sub = new_subs - old_subs
            for s in add_sub:
                self.subs[a_name].subscribe(s)
            rem_sub = old_subs - new_subs
            for s in rem_sub:
                self.subs[a_name].unsubscribe(s)
                if self.subs[a_name].subscription_count == 0:
                    self.destroy_worker(a_name)
dataset/ETHPy150Open practo/r5d4/r5d4/analytics_worker.py/AnalyticsWorker.update_analytics/original