

@defer.inlineCallbacks
def get_updated_tags(self, user_id, stream_id):
    'Get all the tags for the rooms where the tags have changed since the\n        given version\n\n        Args:\n            user_id(str): The user to get the tags for.\n            stream_id(int): The earliest update to get for the user.\n        Returns:\n            A deferred dict mapping from room_id strings to lists of tag\n            strings for all the rooms that changed since the stream_id token.\n        '

    def get_updated_tags_txn(txn):
        sql = 'SELECT room_id from room_tags_revisions WHERE user_id = ? AND stream_id > ?'
        txn.execute(sql, (user_id, stream_id))
        room_ids = [row[0] for row in txn.fetchall()]
        return room_ids
    changed = self._account_data_stream_cache.has_entity_changed(user_id, int(stream_id))
    if (not changed):
        defer.returnValue({
            
        })
    room_ids = (yield self.runInteraction('get_updated_tags', get_updated_tags_txn))
    results = {
        
    }
    if room_ids:
        tags_by_room = (yield self.get_tags_for_user(user_id))
        for room_id in room_ids:
            results[room_id] = tags_by_room.get(room_id, {
                
            })
    defer.returnValue(results)

dataset/ETHPy150Open matrix-org/synapse/synapse/storage/tags.py TagsStore.get_updated_tags/original