LOLINTERNETZ / vscodeoffline

Enables Visual Studio Code's extension gallery to be used in offline (air-gapped) environments. Or, run your own gallery!
https://hub.docker.com/u/lolinternet
MIT License
95 stars 28 forks source link

Download non-prerelease extensions ONLY by default #36

Closed Ebsan closed 1 year ago

Ebsan commented 1 year ago

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

Some other updates are:

Ebsan commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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.

LOLINTERNETZ commented 1 year ago

Comments in https://github.com/LOLINTERNETZ/vscodeoffline/issues/31