@@ -538,7 +538,7 @@ impl RoomEventCacheInner {
538
538
539
539
// Push the new events.
540
540
self . append_events_locked_impl (
541
- Some ( room_events) ,
541
+ room_events,
542
542
events,
543
543
prev_batch,
544
544
account_data,
@@ -558,9 +558,8 @@ impl RoomEventCacheInner {
558
558
ephemeral : Vec < Raw < AnySyncEphemeralRoomEvent > > ,
559
559
ambiguity_changes : BTreeMap < OwnedEventId , AmbiguityChange > ,
560
560
) -> Result < ( ) > {
561
- // Push the new events.
562
561
self . append_events_locked_impl (
563
- None ,
562
+ self . events . write ( ) . await ,
564
563
events,
565
564
prev_batch,
566
565
account_data,
@@ -577,7 +576,7 @@ impl RoomEventCacheInner {
577
576
/// This is a private implementation. It must not be exposed publicly.
578
577
async fn append_events_locked_impl (
579
578
& self ,
580
- room_events : Option < RwLockWriteGuard < ' _ , RoomEvents > > ,
579
+ mut room_events : RwLockWriteGuard < ' _ , RoomEvents > ,
581
580
events : Vec < SyncTimelineEvent > ,
582
581
prev_batch : Option < String > ,
583
582
account_data : Vec < Raw < AnyRoomAccountDataEvent > > ,
@@ -593,11 +592,6 @@ impl RoomEventCacheInner {
593
592
return Ok ( ( ) ) ;
594
593
}
595
594
596
- let mut room_events = match room_events {
597
- Some ( room_events) => room_events,
598
- None => self . events . write ( ) . await ,
599
- } ;
600
-
601
595
// Add the previous back-pagination token (if present), followed by the timeline
602
596
// events themselves.
603
597
{
0 commit comments