def on_gateway_event(self, event): if event['t'] not in self.events: return with self.lock: self.cache.append(event)