mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-23 17:07:32 +00:00
fix: Index remote events by origin_server_ts
This commit is contained in:
1 parent
5687847fe3
commit
919fea9b97
2 files changed
+5
-12
No files matched your search
@@ -180,7 +180,8 @@ migration!(stringify!($name) => $name)
|
||||
// This is backwards compatible because old versions never read the
|
||||
// account data entries it removes.
|
||||
migration!(remove_replaced_account_data),
|
||||
// This is backwards compatible because old versions ignore the `roomts_pduid` keyspace.
|
||||
// This is backwards compatible because old versions ignore the
|
||||
// `roomts_pduid` keyspace.
|
||||
Migration(rooms::timeline::TIMESTAMP_INDEX_MIGRATION, |services| {
|
||||
Box::pin(async {
|
||||
let global = &services.db["global"];
|
||||
|
||||
@@ -23,8 +23,8 @@ use conduwuit_core::{
|
||||
};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt, pin_mut};
|
||||
use ruma::{
|
||||
CanonicalJsonObject, CanonicalJsonValue, MilliSecondsSinceUnixEpoch, OwnedEventId,
|
||||
OwnedRoomId, OwnedServerName, RoomId, RoomVersionId, ServerName, UserId,
|
||||
CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId, OwnedServerName, RoomId,
|
||||
RoomVersionId, ServerName, UserId,
|
||||
events::{
|
||||
AnySyncTimelineEvent, GlobalAccountDataEventType, TimelineEventType,
|
||||
push_rules::PushRulesEvent,
|
||||
@@ -347,17 +347,9 @@ impl super::Service {
|
||||
let count2 = PduCount::Normal(self.services.globals.next_count().unwrap());
|
||||
let pdu_id: RawPduId = PduId { shortroomid, shorteventid: count2 }.into();
|
||||
|
||||
// Remote timestamps are untrusted, so index remote events by when we
|
||||
// received them
|
||||
let index_ts = if self.services.globals.user_is_local(pdu.sender()) {
|
||||
pdu.origin_server_ts()
|
||||
} else {
|
||||
MilliSecondsSinceUnixEpoch::now()
|
||||
};
|
||||
|
||||
// Insert pdu
|
||||
self.db
|
||||
.append_pdu(&pdu_id, pdu, room_id, &pdu_json, count2, index_ts)
|
||||
.append_pdu(&pdu_id, pdu, room_id, &pdu_json, count2, pdu.origin_server_ts())
|
||||
.await;
|
||||
self.progress_extremities(pdu)
|
||||
.await
|
||||
|
||||
Reference in new issue
Block a user