Skip to content

Download non-prerelease extensions ONLY by default #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Aug 8, 2022

Conversation

Ebsan
Copy link
Contributor

@Ebsan Ebsan commented Jul 28, 2022

Takes care of #31 and downloads only non-prerelease versions of extensions.

Some other updates are:

  • Removed use of storing sessions with session = requests.session() in favor of using the the http method directly from the requests object. This was an attempt to fix Failure while fetching extensions. #33.
  • Added the --prerelease-extensions toggle to allow user to download prerelease extensions as well
  • Added the --vscode-version arg to configure version used in User-Agent header. Defaults to 1.69.2, the latest version of VSCode as of today

@Ebsan
Copy link
Contributor Author

Ebsan commented Jul 28, 2022

This pull will cause issues for #24 because only one version of the latest non-prerelease extension will be downloaded. Logic needs to be added to download all the targetTypes of the latest version. Use redhat.java as a good example.

POST
{
    "filters": [
        {
            "criteria": [
                {
                    "filterType": 10,
                    "value": "redhat.java"
                },
                {
                    "filterType": 8,
                    "value": "Microsoft.VisualStudio.Code"
                },
                {
                    "filterType": 12,
                    "value": "4096"
                }
            ],
            "pageNumber": 1,
            "pageSize": 50,
            "sortBy": 0,
            "sortOrder": 0
        }
    ],
    "assetTypes": [],
    "flags": 950
}

@tomer953
Copy link
Contributor

Hi,

I advise to test the removal of the requests sessions, this should increase performence.
however, when requests fails we can use some retry mechanisem, for instance:

from requests.adapters import HTTPAdapter, Retry

retries = Retry(total=5, backoff_factor=1, status_forcelist=[ 413, 429, 500, 501, 502, 503, 504,  ], allowed_methods=["HEAD", "GET", "PUT", "DELETE", "OPTIONS", "TRACE"])
session = requests.session()
session.mount('https://', HTTPAdapter(max_retries=retries))
# session.get(...)

@Ebsan
Copy link
Contributor Author

Ebsan commented Aug 1, 2022

@tomer953 I will test your recommendation in another pull request. I can probably run some timed tests for the different requests solutions as well in that pull request.

@tristan-morris tristan-morris merged commit a0b3763 into LOLINTERNETZ:main Aug 8, 2022
@LOLINTERNETZ
Copy link
Owner

Comments in #31

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.

Failure while fetching extensions.
4 participants