Skip to content

improve ipfs downloads#2374

Draft
Marketen wants to merge 1 commit intodevelopfrom
marc/improve-ipfs
Draft

improve ipfs downloads#2374
Marketen wants to merge 1 commit intodevelopfrom
marc/improve-ipfs

Conversation

@Marketen
Copy link
Contributor

This pull request introduces significant improvements to the IPFS download and gateway handling logic, focusing on reliability, error handling, and code maintainability. The main changes include adding retry logic for IPFS gateway downloads, refactoring file download and writing logic for clarity and robustness, and fixing a few parameter handling bugs.

IPFS Gateway Download Reliability and Error Handling:

  • Introduced retry logic for IPFS gateway downloads in DappnodeRepository, including configurable retry attempts, delays, and error normalization, to improve robustness when fetching content from IPFS gateways. [1] [2]
  • Refactored the getAndVerifyContentFromGateway method to accept a gatewayUrl parameter, allowing dynamic selection of gateways and supporting the new retry mechanism.

File Download and Writing Refactor:

  • Replaced the custom download logic in downloadToFs with a new writeReadableToFs helper that handles timeouts, progress tracking, and error propagation in a more maintainable way. [1] [2]
  • Updated the writeFileToMemory method to use the new retry mechanism, ensuring in-memory downloads are also resilient to gateway failures. [1] [2]

Bug Fixes and Parameter Handling:

  • Fixed a bug in getImage where isAbsolute("/") was incorrectly used instead of isAbsolute(path) for validating file paths.
  • Corrected the fallback value for db.ipfsGateway.set to use params.IPFS_REMOTE instead of params.IPFS_GATEWAY in changeIpfsClient.

Other Improvements:

  • Changed downloadImages to use a sequential for...of loop instead of Promise.all for better control over download order and logging. [1] [2]

@github-actions github-actions bot temporarily deployed to commit February 18, 2026 11:38 Inactive
@github-actions
Copy link

@Marketen Marketen closed this Feb 25, 2026
@Marketen Marketen reopened this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant