@@ -33,15 +33,16 @@ export class ContentManager {
3333 }
3434
3535 /**
36- * Download any blobs that we don't have locally from this content .
36+ * Download any blobs in the array that we don't have locally.
3737 * This is used so that blobs of an identity will eventually
3838 * persist on other devices in that identity.
3939 */
40- async pullBlobs ( content : Proto . Content ) : Promise < void > {
41- const digests = this . collectBlobDigests ( content ) ;
40+ async pullBlobs ( blobs : Proto . Blob [ ] ) : Promise < void > {
41+ const digests = blobs . map ( ( b ) => b . digest ) . filter ( ( d ) => ! ! d ) ;
42+
4243 if ( digests . length === 0 ) return ;
4344
44- await Promise . all (
45+ await Promise . allSettled (
4546 digests . map ( async ( digest ) => {
4647 try {
4748 if ( await this . client . filestoreDriver . has ( digest ) ) return ;
@@ -56,14 +57,14 @@ export class ContentManager {
5657 }
5758
5859 /**
59- * Collect all blob digests referenced in a post or profile update
60+ * Collect all blobs referenced in a post or profile update
6061 */
61- private collectBlobDigests ( content : Proto . Content ) : Proto . ContentDigest [ ] {
62- const out : Proto . ContentDigest [ ] = [ ] ;
62+ static collectBlobs ( content : Proto . Content ) : Proto . Blob [ ] {
63+ const out : Proto . Blob [ ] = [ ] ;
6364 const pushSet = ( set ?: Proto . ImageSet ) => {
6465 if ( ! set ) return ;
6566 for ( const img of set . images ) {
66- if ( img . blob ?. digest ) out . push ( img . blob . digest ) ;
67+ if ( img . blob ) out . push ( img . blob ) ;
6768 }
6869 } ;
6970 const body = content . contentBody ;
0 commit comments