def execute(self, url, topic): pattern = Pattern(topic) subscriptions = self.subscriptions_repo.get_subscriptions_by_pattern(pattern) subscriptions_by_url = [s for s in subscriptions if s.callback_url == url] if not subscriptions_by_url: raise SubscriptionNotFound() self.subscriptions_repo.bulk_delete([pattern.to_key(url)])
def execute(self, callback: str = None, topic: str = None): pattern = Pattern(topic) subscriptions = self.subscriptions_repo.get_subscriptions_by_pattern( pattern) subscriptions_by_callbacks = [ s for s in subscriptions if s.callback_url == callback ] if not subscriptions_by_callbacks: raise SubscriptionNotFoundError() self.subscriptions_repo.bulk_delete([pattern.to_key(callback)])