File tree Expand file tree Collapse file tree 1 file changed +13
-14
lines changed
backend/src/useCases/objects Expand file tree Collapse file tree 1 file changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -315,20 +315,19 @@ const getNonArchivedObjects = async () => {
315315}
316316
317317const populateCaches = async ( cid : string ) => {
318- downloadService
319- . download ( cid )
320- . then ( ( stream ) => {
321- logger . debug (
322- `Downloaded object (cid=${ cid } ) from DB after archival check` ,
323- )
324- consumeStream ( stream )
325- } )
326- . catch ( ( e ) => {
327- logger . warn (
328- `Failed to download object (cid=${ cid } ) from DB after archival check: ${ e } ` ,
329- )
330- throw e
331- } )
318+ try {
319+ const stream = await downloadService . download ( cid )
320+
321+ logger . debug ( `Downloaded object (cid=${ cid } ) from DB after archival check` )
322+
323+ // Wait until the entire stream has been consumed (and therefore cached)
324+ await consumeStream ( stream )
325+ } catch ( e ) {
326+ logger . warn (
327+ `Failed to download object (cid=${ cid } ) from DB after archival check: ${ e } ` ,
328+ )
329+ throw e
330+ }
332331}
333332
334333const onObjectArchived = async ( cid : string ) => {
You can’t perform that action at this time.
0 commit comments