Use FrozenEvent's reject_reason to decide whether to return it; don't include allow_rejected in the main getEvents cache key

This commit is contained in:
Paul "LeoNerd" Evans 2015-03-25 17:33:26 +00:00
parent 1b988b051b
commit f173d40a32

View file

@ -749,10 +749,13 @@ class SQLBaseStore(object):
try: try:
# Separate cache entries for each way to invoke _get_event_txn # Separate cache entries for each way to invoke _get_event_txn
ret = cache[(check_redacted, get_prev_content, allow_rejected)] ret = cache[(check_redacted, get_prev_content)]
cache_counter.inc_hits("*getEvent*") cache_counter.inc_hits("*getEvent*")
if allow_rejected or not ret.rejected_reason:
return ret return ret
else:
return None
except KeyError: except KeyError:
cache_counter.inc_misses("*getEvent*") cache_counter.inc_misses("*getEvent*")
pass pass
@ -779,14 +782,15 @@ class SQLBaseStore(object):
start_time = update_counter("select_event", start_time) start_time = update_counter("select_event", start_time)
if allow_rejected or not rejected_reason:
result = self._get_event_from_row_txn( result = self._get_event_from_row_txn(
txn, internal_metadata, js, redacted, txn, internal_metadata, js, redacted,
check_redacted=check_redacted, check_redacted=check_redacted,
get_prev_content=get_prev_content, get_prev_content=get_prev_content,
rejected_reason=rejected_reason, rejected_reason=rejected_reason,
) )
cache[(check_redacted, get_prev_content, allow_rejected)] = result cache[(check_redacted, get_prev_content)] = result
if allow_rejected or not rejected_reason:
return result return result
else: else:
return None return None