@@ -88,10 +88,7 @@ pub(super) async fn store_sliding_sync_state(
88
88
storage
89
89
. set_custom_value (
90
90
instance_storage_key. as_bytes ( ) ,
91
- serde_json:: to_vec ( & FrozenSlidingSync :: new (
92
- position,
93
- & * sliding_sync. inner . rooms . read ( ) . await ,
94
- ) ) ?,
91
+ serde_json:: to_vec ( & FrozenSlidingSync :: new ( & * sliding_sync. inner . rooms . read ( ) . await ) ) ?,
95
92
)
96
93
. await ?;
97
94
@@ -184,7 +181,6 @@ pub(super) async fn restore_sliding_sync_list(
184
181
/// Fields restored during `restore_sliding_sync_state`.
185
182
#[ derive( Default ) ]
186
183
pub ( super ) struct RestoredFields {
187
- pub delta_token : Option < String > ,
188
184
pub to_device_token : Option < String > ,
189
185
pub pos : Option < String > ,
190
186
pub rooms : BTreeMap < OwnedRoomId , SlidingSyncRoom > ,
@@ -223,20 +219,14 @@ pub(super) async fn restore_sliding_sync_state(
223
219
. map ( |custom_value| serde_json:: from_slice :: < FrozenSlidingSync > ( & custom_value) )
224
220
{
225
221
// `SlidingSync` has been found and successfully deserialized.
226
- Some ( Ok ( FrozenSlidingSync {
227
- to_device_since,
228
- delta_token : frozen_delta_token,
229
- rooms : frozen_rooms,
230
- } ) ) => {
222
+ Some ( Ok ( FrozenSlidingSync { to_device_since, rooms : frozen_rooms } ) ) => {
231
223
trace ! ( "Successfully read the `SlidingSync` from the cache" ) ;
232
224
// Only update the to-device token if we failed to read it from the crypto store
233
225
// above.
234
226
if restored_fields. to_device_token . is_none ( ) {
235
227
restored_fields. to_device_token = to_device_since;
236
228
}
237
229
238
- restored_fields. delta_token = frozen_delta_token;
239
-
240
230
#[ cfg( feature = "e2e-encryption" ) ]
241
231
{
242
232
if let Some ( olm_machine) = & * client. olm_machine ( ) . await {
@@ -478,11 +468,9 @@ mod tests {
478
468
assert ! ( state_store. get_custom_value( full_storage_key. as_bytes( ) ) . await ?. is_none( ) ) ;
479
469
480
470
// Emulate some data to be cached.
481
- let delta_token = "delta_token" . to_owned ( ) ;
482
471
let pos = "pos" . to_owned ( ) ;
483
472
{
484
473
let mut position_guard = sliding_sync. inner . position . lock ( ) . await ;
485
- position_guard. delta_token = Some ( delta_token. clone ( ) ) ;
486
474
position_guard. pos = Some ( pos. clone ( ) ) ;
487
475
488
476
// Then, we can correctly cache the sliding sync instance.
@@ -496,7 +484,6 @@ mod tests {
496
484
state_store. get_custom_value( full_storage_key. as_bytes( ) ) . await ?,
497
485
Some ( bytes) => {
498
486
let deserialized: FrozenSlidingSync = serde_json:: from_slice( & bytes) ?;
499
- assert_eq!( deserialized. delta_token, Some ( delta_token. clone( ) ) ) ;
500
487
assert!( deserialized. to_device_since. is_none( ) ) ;
501
488
}
502
489
) ;
@@ -509,7 +496,6 @@ mod tests {
509
496
. expect ( "must have restored sliding sync fields" ) ;
510
497
511
498
// After restoring, the delta token and to-device token could be read.
512
- assert_eq ! ( restored_fields. delta_token. unwrap( ) , delta_token) ;
513
499
assert_eq ! ( restored_fields. pos. unwrap( ) , pos) ;
514
500
515
501
// Test the "migration" path: assume a missing to-device token in crypto store,
@@ -531,7 +517,6 @@ mod tests {
531
517
full_storage_key. as_bytes ( ) ,
532
518
serde_json:: to_vec ( & FrozenSlidingSync {
533
519
to_device_since : Some ( to_device_token. clone ( ) ) ,
534
- delta_token : Some ( delta_token. clone ( ) ) ,
535
520
rooms : vec ! [ FrozenSlidingSyncRoom {
536
521
room_id: owned_room_id!( "!r0:matrix.org" ) ,
537
522
prev_batch: Some ( "t0ken" . to_owned( ) ) ,
@@ -547,7 +532,6 @@ mod tests {
547
532
548
533
// After restoring, the delta token, the to-device since token, stream
549
534
// position and rooms could be read from the state store.
550
- assert_eq ! ( restored_fields. delta_token. unwrap( ) , delta_token) ;
551
535
assert_eq ! ( restored_fields. to_device_token. unwrap( ) , to_device_token) ;
552
536
assert_eq ! ( restored_fields. pos. unwrap( ) , pos) ;
553
537
assert_eq ! ( restored_fields. rooms. len( ) , 1 ) ;
0 commit comments