pull/536/head
Erik Johnston 2016-01-27 17:11:04 +00:00
parent aca3193efb
commit e7febf4fbb
3 changed files with 9 additions and 6 deletions

View File

@ -128,7 +128,9 @@ class EventsStore(SQLBaseStore):
is_new_state=is_new_state, is_new_state=is_new_state,
current_state=current_state, current_state=current_state,
) )
self._events_stream_cache.room_has_changed(None, event.room_id, stream_ordering) self._events_stream_cache.room_has_changed(
None, event.room_id, stream_ordering
)
except _RollbackButIsFineException: except _RollbackButIsFineException:
pass pass

View File

@ -15,12 +15,10 @@
from ._base import SQLBaseStore from ._base import SQLBaseStore
from synapse.util.caches.descriptors import cachedInlineCallbacks, cachedList, cached from synapse.util.caches.descriptors import cachedInlineCallbacks, cachedList, cached
from synapse.util.caches import cache_counter, caches_by_name
from synapse.util.caches.room_change_cache import RoomStreamChangeCache from synapse.util.caches.room_change_cache import RoomStreamChangeCache
from twisted.internet import defer from twisted.internet import defer
from blist import sorteddict
import logging import logging
import ujson as json import ujson as json

View File

@ -262,7 +262,8 @@ class StreamStore(SQLBaseStore):
def f(txn): def f(txn):
if from_id is not None: if from_id is not None:
sql = ( sql = (
"SELECT m.event_id, stream_ordering FROM events AS e, room_memberships AS m" "SELECT m.event_id, stream_ordering FROM events AS e,"
" room_memberships AS m"
" WHERE e.event_id = m.event_id" " WHERE e.event_id = m.event_id"
" AND m.user_id = ?" " AND m.user_id = ?"
" AND e.stream_ordering > ? AND e.stream_ordering <= ?" " AND e.stream_ordering > ? AND e.stream_ordering <= ?"
@ -271,7 +272,8 @@ class StreamStore(SQLBaseStore):
txn.execute(sql, (user_id, from_id, to_id,)) txn.execute(sql, (user_id, from_id, to_id,))
else: else:
sql = ( sql = (
"SELECT m.event_id, stream_ordering FROM events AS e, room_memberships AS m" "SELECT m.event_id, stream_ordering FROM events AS e,"
" room_memberships AS m"
" WHERE e.event_id = m.event_id" " WHERE e.event_id = m.event_id"
" AND m.user_id = ?" " AND m.user_id = ?"
" AND stream_ordering <= ?" " AND stream_ordering <= ?"
@ -307,7 +309,8 @@ class StreamStore(SQLBaseStore):
"SELECT c.room_id FROM history_visibility AS h" "SELECT c.room_id FROM history_visibility AS h"
" INNER JOIN current_state_events AS c" " INNER JOIN current_state_events AS c"
" ON h.event_id = c.event_id" " ON h.event_id = c.event_id"
" WHERE c.room_id IN (%s) AND h.history_visibility = 'world_readable'" % ( " WHERE c.room_id IN (%s)"
" AND h.history_visibility = 'world_readable'" % (
",".join(map(lambda _: "?", room_ids)) ",".join(map(lambda _: "?", room_ids))
) )
) )