Skip to content

Conversation

@yashkohli88
Copy link
Contributor

Overview

This PR migrates away from the deprecated request and requestretry libraries in favor of an axios-based solution (axios, axios-retry). A new helper, getStream, is introduced to handle streaming downloads across package fetchers, reducing maintenance burden and improving long-term support.

Main Changes

  • Refactor Download Logic:
    Replaces usage of request in all package fetchers (conda, debian, go, maven, npm, composer, pypi, ruby) with a new getStream helper in lib/fetch.js.
  • Retry Logic Update:
    Replaces requestretry with axios-retry for HTTP retry support. Centralizes retry logic in callFetchWithRetry.
  • Code Simplification & Maintenance:
    Removes now-unnecessary callback-based code and error handling, moving to promise-based, modern patterns.
  • Test Enhancements:
    Updates unit tests and stubs to use new axios-based methods and async/await.
  • API Consistency:
    All fetchers now consistently return streams and/or promise-based results.
  • Exponential Backoff Support:
    Adds exponential delay to retries.

Notable File/Code Changes

  • lib/fetch.js
    • Adds getStream and callFetchWithRetry.
    • Switches HTTP requests and retry to axios + axios-retry.
  • *All providers/fetch/Fetch.js
    • Refactored from request/requestretry to the new helpers.
    • Error handling and stream logic updated to promises and async/await.
  • package.json
    • Removes request and requestretry dependencies.
  • Tests
    • Refactored all related test stubs and mocks to support new interfaces.

Backwards Compatibility

  • Code maintains the same external behavior for package downloads and retries; only the underlying HTTP/request implementation has changed.

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