@@ -287,6 +287,8 @@ impl Graph {
287
287
} )
288
288
. collect ( ) ;
289
289
290
+ // we skip checking PRIDs for connections that we just added
291
+ let prids_skip_list = ids_to_add. clone ( ) ;
290
292
// Now try to add new connections into pages already being updated
291
293
// Note: these pages have already been cloned, so we don't clone them again
292
294
let mut add_iter = ids_to_add. iter ( ) . cloned ( ) . peekable ( ) ;
@@ -300,6 +302,7 @@ impl Graph {
300
302
aggressive,
301
303
dsnp_version_config,
302
304
& encryption_key,
305
+ & prids_skip_list,
303
306
) ;
304
307
305
308
if let None = add_iter. peek ( ) {
@@ -335,6 +338,7 @@ impl Graph {
335
338
PageFullnessMode :: Aggressive ,
336
339
dsnp_version_config,
337
340
& encryption_key,
341
+ & prids_skip_list,
338
342
) ;
339
343
340
344
if page_modified {
@@ -361,6 +365,7 @@ impl Graph {
361
365
PageFullnessMode :: Aggressive ,
362
366
dsnp_version_config,
363
367
& encryption_key,
368
+ & prids_skip_list,
364
369
) {
365
370
updated_pages. insert ( new_page. page_id ( ) , new_page) ;
366
371
}
@@ -377,6 +382,7 @@ impl Graph {
377
382
fullness_mode : PageFullnessMode ,
378
383
dsnp_version_config : & DsnpVersionConfig ,
379
384
encryption_key : & Option < ResolvedKeyPair > ,
385
+ prid_skip_list : & Vec < DsnpUserId > ,
380
386
) -> bool {
381
387
let mut page_modified = false ;
382
388
while let Some ( id_to_add) = add_iter. peek ( ) {
@@ -386,6 +392,7 @@ impl Graph {
386
392
fullness_mode,
387
393
dsnp_version_config,
388
394
encryption_key,
395
+ prid_skip_list,
389
396
) {
390
397
page_modified = true ;
391
398
let _ = add_iter. next ( ) ; // TODO: prefer advance_by(1) once that stabilizes
@@ -651,7 +658,7 @@ impl Graph {
651
658
fn apply_prids (
652
659
& self ,
653
660
updated_page : & mut GraphPage ,
654
- ids_to_add : & Vec < DsnpUserId > ,
661
+ prid_skip_list : & Vec < DsnpUserId > ,
655
662
encryption_key : & ResolvedKeyPair ,
656
663
) -> DsnpGraphResult < ( ) > {
657
664
if self . get_connection_type ( ) != ConnectionType :: Friendship ( PrivacyType :: Private ) {
@@ -665,9 +672,9 @@ impl Graph {
665
672
. connections ( )
666
673
. clone ( )
667
674
. iter ( )
668
- . filter ( |c| !ids_to_add . contains ( & c. user_id ) )
675
+ . filter ( |c| !prid_skip_list . contains ( & c. user_id ) )
669
676
{
670
- if duration_days_since ( c. since ) > max_allowed_stale_days &&
677
+ if // duration_days_since(c.since) > max_allowed_stale_days &&
671
678
!self
672
679
. user_key_manager
673
680
. read ( )
@@ -704,6 +711,7 @@ impl Graph {
704
711
mode : PageFullnessMode ,
705
712
dsnp_version_config : & DsnpVersionConfig ,
706
713
encryption_key : & Option < ResolvedKeyPair > ,
714
+ prid_skip_list : & Vec < DsnpUserId > ,
707
715
) -> DsnpGraphResult < ( ) > {
708
716
let connection_type = self . get_connection_type ( ) ;
709
717
let max_connections_per_page =
@@ -737,7 +745,7 @@ impl Graph {
737
745
ConnectionType :: Friendship ( PrivacyType :: Private ) => {
738
746
let encryption_key =
739
747
encryption_key. as_ref ( ) . ok_or ( DsnpGraphError :: NoResolvedActiveKeyFound ) ?;
740
- self . apply_prids ( & mut temp_page, & vec ! [ * connection_id ] , & encryption_key)
748
+ self . apply_prids ( & mut temp_page, prid_skip_list , & encryption_key)
741
749
. expect ( "Error applying prids to page" ) ;
742
750
temp_page. to_private_page_data ( dsnp_version_config, & encryption_key)
743
751
} ,
0 commit comments