Commit graph

72 commits

Author SHA1 Message Date
Sumner Evans
cdf97a2df3
backfill: set backfill status state event 2022-05-20 10:22:33 -06:00
Sumner Evans
4eac1ea719
backfill state: update during backfill 2022-05-20 10:22:30 -06:00
Tulir Asokan
962179fb75 Handle edge cases with missing senders in historical messages 2022-05-19 12:08:31 +03:00
Tulir Asokan
f39fff3285
Send first batch of events without historical flag (#498) 2022-05-19 11:36:42 +03:00
Sumner Evans
ec8f75e50e
backfill: add option to mark unread using account data 2022-05-18 10:40:29 -06:00
Sumner Evans
df46ca99f9
backfill: remove intermediate buffer for backfill 2022-05-16 14:04:22 -06:00
Sumner Evans
f3f6d88e55
backfill: perform batch finish in transaction 2022-05-15 21:43:12 -06:00
Sumner Evans
c1bf0e6555
backfill queue: set the dispatch time instead of completed time 2022-05-15 21:42:42 -06:00
Sumner Evans
1d70cbff48
backfill queue: add dispatch time, remove time end to table
* the dispatch time is going to be what the completed time used to be
* the time end column was always nil, so I got rid of it
2022-05-15 21:42:38 -06:00
Tulir Asokan
f74af8eb30 Update whatsmeow and improve history sync logging 2022-05-14 14:17:03 +03:00
Tulir Asokan
6f14475667 Switch to ParseWebMessage from whatsmeow 2022-05-13 16:08:33 +03:00
Tulir Asokan
1f6cedf948 Reduce unnecessary invite calls during history sync 2022-05-13 11:19:52 +03:00
Sumner Evans
8cb41b8949
Merge pull request #490 from mautrix/sumner/bri-3238
media backfill: allow media requests to be performed at a specific local time for the user
2022-05-12 11:31:54 -06:00
Sumner Evans
b42aa16684
media backfill: store media key in request
This way, we don't have to fetch the event from Matrix in these situations
2022-05-12 11:30:42 -06:00
Tulir Asokan
4a5fbcb13a Fix disappearing message notice spam when backfilling 2022-05-12 20:00:31 +03:00
Sumner Evans
08e77fab29
media backfill: send retry requests at the configured time
Only does the batch send of requests if the request method is 'local_time'
2022-05-11 17:10:55 -06:00
Sumner Evans
7de7fedc02
media backfill: enable enqueue to media backfill buffer instead of immediately requesting retry receipt 2022-05-11 17:10:55 -06:00
Sumner Evans
b5551ee16a
database: add media requests buffer table 2022-05-11 17:10:55 -06:00
Sumner Evans
e362743f18
config: add settings for automatic media requests 2022-05-11 17:10:55 -06:00
Tulir Asokan
317b4dbffb Fix panic in requesting retries 2022-05-02 15:47:35 +03:00
Tulir Asokan
4bc4e92877 Remove media backfill queue and just request immediately 2022-05-02 15:00:57 +03:00
Sumner Evans
89131bd20c
backfill: add notification of disappearing messages at correct timestamp
This makes it so that the timestamp of the chat in Matrix looks correct,
even though the message is not there to be bridged since it has
disappeared.
2022-04-29 16:59:37 -06:00
Tulir Asokan
331138bc6b Split forward backfilling and do it in one batch
Multiple batches is complicated, as it would require figuring out where
the batch ended when handling the next batch of new-old messages.
2022-04-29 11:07:05 +03:00
Sumner Evans
76c6d0bf87
backfill: fixed bug where the media backfill loop would sleep too often
If the number of requested message was a multiple of the number of batch
events, then it would sleep on every single other message (even if not
an errored media message).
2022-04-28 15:48:40 -06:00
Sumner Evans
d898aefff1
backfill loops: combine immediate and deferred loops 2022-04-28 15:48:38 -06:00
Sumner Evans
ac7a437ad8
backfill: add more logging to the queue 2022-04-28 15:48:04 -06:00
Sumner Evans
f32c5f2e9a
backfill: fix priority of backfills again
I think this finally has the correct logic for doing each stage for each
portal before going on to the next stage.
2022-04-23 21:50:47 -06:00
Sumner Evans
a1e2e673dc
backfill: fix bridging of ephemeral and view-once messages 2022-04-22 14:07:59 -06:00
Sumner Evans
e74bb62fc1
backfill logging: fix logging of Backfill structs 2022-04-19 11:19:42 -06:00
Sumner Evans
f2e762680c
media backfill: add ability to automatically request media not on WA server
This adds a new backfill type for media that sends a request to the
phone for every media that is not available on the WA servers. WA
deletes media from their servers after about two weeks, so you have to
ask the phone to re-upload it.

In order to use this, you need to enable
bridge.history_sync.backfill_media and configure the requests that will
be made per portal using bridge.history_sync.media (which is similar to
the deferred backfill config).

If you already have backfilled portals, but want to do a one-off media
backfill for all existing portals, you can set
bridge.history_sync.enqueue_backfill_media_next_start to true.
2022-04-19 08:12:51 -06:00
Tulir Asokan
c98b7f32c9 Fix handling errors from batch sending 2022-04-19 11:39:17 +03:00
Tulir Asokan
2c68ccc0a3 Clean up some backfill things 2022-04-18 20:12:24 +03:00
Tulir Asokan
1250e2d605 More backfill fixes 2022-04-17 00:46:15 +03:00
Tulir Asokan
3933b743e7 Maybe fix backfilling multiple batches within deferred backfill
Might fix #471
2022-04-17 00:09:31 +03:00
Tulir Asokan
e6da32518e Don't create rooms with no messages when backfilling 2022-04-16 23:58:15 +03:00
Tulir Asokan
1a5d5f5adf Adjust logs and other things 2022-04-16 22:58:47 +03:00
Sumner Evans
daed67420c
historysync: fix backfill logic again
* INITIAL_BOOTSTRAP doesn't have 100% as the progress
* Enqueue deferred backfills after both RECENT and FULL progress gets to
  the necessary levels
2022-04-13 10:15:51 -06:00
Sumner Evans
22cc21a438
historysync: refactor backfill enqueue logic 2022-04-12 08:58:47 -06:00
Sumner Evans
eedbecd5ab
historysync: add logging of progress 2022-04-12 08:32:00 -06:00
Sumner Evans
78c6d57299
historysync: only save when backfill is enabled 2022-04-06 09:00:48 -06:00
Sumner Evans
eb0a13a753
historysync: use userID, conversationID, messageID as PK 2022-04-05 13:16:31 -06:00
Sumner Evans
173edfaaf1
batch send: fix plaintext content
Co-authored-by: Tulir Asokan <tulir@maunium.net>
2022-04-05 13:16:29 -06:00
Sumner Evans
a8be4b11a8
historysync: start deferred backfill on non-full syncs
Co-authored-by: Tulir Asokan <tulir@maunium.net>
2022-04-05 13:16:01 -06:00
Sumner Evans
748c9509a1
historysync: lock earlier to prevent races and duplicate messages
Closes BRI-2709
2022-04-04 16:07:25 -06:00
Sumner Evans
54534f6b42
historysync: enqueue immediate backfill on INITIAL_BOOTSTRAP 2022-03-30 17:59:55 -06:00
Sumner Evans
830c294b91
historysync: delete history sync messages once backfilled 2022-03-30 17:40:23 -06:00
Sumner Evans
8a49fea812
backfill: backfill conversation when started
This applies to when the conversation is started via the provisioning
API (start new chat) or when a new message comes in to that portal.
2022-03-29 23:40:22 -06:00
Sumner Evans
12a23e2ca5
historysync: refactor to utilize backfill queue
Also sends the `m.room.marker` event when a backfill stage is complete.
2022-03-29 19:26:11 -06:00
Tulir Asokan
44f232f37b Remove special-cased fast backfill
It's not particularly useful and causes the portals to jump around more
2022-03-15 00:04:40 +02:00
Tulir Asokan
df64bb0e10 Handle disappearing messages in history sync properly 2022-03-15 00:03:37 +02:00