@@ -1107,6 +1107,11 @@ mod private {
11071107 {
11081108 self . state . room_linked_chunk . revents ( ) . find_map ( |( _position, event) | predicate ( event) )
11091109 }
1110+
1111+ #[ cfg( test) ]
1112+ pub fn is_dirty ( & self ) -> bool {
1113+ EventCacheStoreLockGuard :: is_dirty ( & self . store )
1114+ }
11101115 }
11111116
11121117 impl < ' a > RoomEventCacheStateLockWriteGuard < ' a > {
@@ -2071,6 +2076,11 @@ mod private {
20712076
20722077 Ok ( ( ) )
20732078 }
2079+
2080+ #[ cfg( test) ]
2081+ pub fn is_dirty ( & self ) -> bool {
2082+ EventCacheStoreLockGuard :: is_dirty ( & self . store )
2083+ }
20742084 }
20752085
20762086 /// Load a linked chunk's full metadata, making sure the chunks are
@@ -4113,6 +4123,9 @@ mod timed_tests {
41134123 // shared access.
41144124 // See `RoomEventCacheStateLock::read` to learn more.
41154125
4126+ // The lock is no longer marked as dirty, it's been cleaned.
4127+ assert ! ( guard. is_dirty( ) . not( ) ) ;
4128+
41164129 // The reload can be observed via the updates too.
41174130 assert_matches ! (
41184131 updates_stream. recv( ) . await . unwrap( ) ,
@@ -4166,6 +4179,9 @@ mod timed_tests {
41664179 // Guard is kept alive, to ensure we can have multiple read guards alive with a
41674180 // shared access.
41684181
4182+ // The lock is no longer marked as dirty, it's been cleaned.
4183+ assert ! ( guard. is_dirty( ) . not( ) ) ;
4184+
41694185 // The reload can be observed via the updates too.
41704186 assert_matches ! (
41714187 updates_stream. recv( ) . await . unwrap( ) ,
@@ -4219,6 +4235,9 @@ mod timed_tests {
42194235
42204236 let guard = room_event_cache. inner . state . write ( ) . await . unwrap ( ) ;
42214237
4238+ // The lock is no longer marked as dirty, it's been cleaned.
4239+ assert ! ( guard. is_dirty( ) . not( ) ) ;
4240+
42224241 // The reload can be observed via the updates too.
42234242 assert_matches ! (
42244243 updates_stream. recv( ) . await . unwrap( ) ,
@@ -4266,6 +4285,9 @@ mod timed_tests {
42664285
42674286 let guard = room_event_cache. inner . state . write ( ) . await . unwrap ( ) ;
42684287
4288+ // The lock is no longer marked as dirty, it's been cleaned.
4289+ assert ! ( guard. is_dirty( ) . not( ) ) ;
4290+
42694291 // The reload can be observed via the updates too.
42704292 assert_matches ! (
42714293 updates_stream. recv( ) . await . unwrap( ) ,
0 commit comments