mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-23 09:04:06 -04:00
Handle RRs which arrive before their events
This commit is contained in:
parent
857e6fd8b6
commit
9f797a24a4
1 changed files with 18 additions and 24 deletions
|
@ -13,7 +13,7 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from synapse.api.errors import NotFoundError
|
|
||||||
from ._base import SQLBaseStore
|
from ._base import SQLBaseStore
|
||||||
from .util.id_generators import StreamIdGenerator
|
from .util.id_generators import StreamIdGenerator
|
||||||
from synapse.util.caches.descriptors import cachedInlineCallbacks, cachedList, cached
|
from synapse.util.caches.descriptors import cachedInlineCallbacks, cachedList, cached
|
||||||
|
@ -340,17 +340,11 @@ class ReceiptsStore(ReceiptsWorkerStore):
|
||||||
allow_none=True
|
allow_none=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if not res:
|
stream_ordering = int(res["stream_ordering"]) if res else None
|
||||||
raise NotFoundError(
|
|
||||||
"Cannot set read receipt on unknown event %s" % (
|
|
||||||
event_id,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
stream_ordering = int(res["stream_ordering"])
|
|
||||||
|
|
||||||
# We don't want to clobber receipts for more recent events, so we
|
# We don't want to clobber receipts for more recent events, so we
|
||||||
# have to compare orderings of existing receipts
|
# have to compare orderings of existing receipts
|
||||||
|
if stream_ordering is not None:
|
||||||
sql = (
|
sql = (
|
||||||
"SELECT stream_ordering, event_id FROM events"
|
"SELECT stream_ordering, event_id FROM events"
|
||||||
" INNER JOIN receipts_linearized as r USING (event_id, room_id)"
|
" INNER JOIN receipts_linearized as r USING (event_id, room_id)"
|
||||||
|
@ -413,7 +407,7 @@ class ReceiptsStore(ReceiptsWorkerStore):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
if receipt_type == "m.read":
|
if receipt_type == "m.read" and stream_ordering is not None:
|
||||||
self._remove_old_push_actions_before_txn(
|
self._remove_old_push_actions_before_txn(
|
||||||
txn,
|
txn,
|
||||||
room_id=room_id,
|
room_id=room_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue