Skip to content

Commit

Permalink
Reduce concurrency in PNG compression
Browse files Browse the repository at this point in the history
  • Loading branch information
onyb committed Jan 10, 2024
1 parent 309fb03 commit 899150e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ env:

jobs:
build:
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: brew install librsvg libimagequant pkg-config
- run: sudo apt-get update -y
- run: sudo apt-get install -y librsvg2-bin libimagequant-dev pkg-config
- run: npm install -g yarn
- run: yarn --version
- run: yarn
Expand Down
22 changes: 11 additions & 11 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,18 @@ async function stageEVMTokenImages(stagingDir, inputTokenFilePath) {
}

async function compressPng(imagesDstPath, stagingDir) {
console.log('compressing png images...')
if (!fs.existsSync(stagingDir + '/images')) {
fs.mkdirSync(stagingDir + '/images')
console.log("compressing png images...")
if (!fs.existsSync(stagingDir + "/images")) {
fs.mkdirSync(stagingDir + "/images")
}
await imagemin([imagesDstPath + "/*.png"], {
destination: stagingDir + '/images',
plugins: [
imageminPngquant({
quality: [0.1, 0.3]
})
]
})
destination: stagingDir + "/images",
plugins: [
imageminPngquant({
quality: [0.1, 0.3],
}),
],
})
}

async function stageTokenListsLogo(stagingDir, token) {
Expand Down Expand Up @@ -182,7 +182,7 @@ async function stageTokenListsLogo(stagingDir, token) {

async function stageTokenListsTokens(stagingDir, tokens, coingeckoIds, isEVM = true) {
// Use an asynchronous job queue to throttle downloads.
const q = new Qyu({concurrency: 4})
const q = new Qyu({concurrency: 2})
q(tokens, async (token, idx) => {
tokens[idx].logoURI = await stageTokenListsLogo(stagingDir, token)
})
Expand Down
16 changes: 1 addition & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,7 @@ asynckit@^0.4.0:
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==

axios-retry@^3.2.5:
version "3.9.1"
resolved "https://registry.yarnpkg.com/axios-retry/-/axios-retry-3.9.1.tgz#c8924a8781c8e0a2c5244abf773deb7566b3830d"
integrity sha512-8PJDLJv7qTTMMwdnbMvrLYuvB47M81wRtxQmEdV5w4rgbTXTt+vtPkXwajOfOdSyv/wZICJOC+/UhXH4aQ/R+w==
dependencies:
"@babel/runtime" "^7.15.4"
is-retry-allowed "^2.2.0"

axios@>=1.6.0, axios@^0.27.2:
axios@>=1.6.0:
version "1.6.5"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.5.tgz#2c090da14aeeab3770ad30c3a1461bc970fb0cd8"
integrity sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==
Expand All @@ -105,7 +97,6 @@ base64-js@^1.3.1:

bin-build@^3.0.0, "bin-build@github:brave/bin-build#fb92d12":
version "3.1.0"
uid fb92d12ea08e9770f9fb00f806b520aaec714bda
resolved "https://codeload.github.com/brave/bin-build/tar.gz/fb92d12ea08e9770f9fb00f806b520aaec714bda"
dependencies:
decompress "^4.0.0"
Expand Down Expand Up @@ -599,11 +590,6 @@ find-versions@^5.0.0:
dependencies:
semver-regex "^4.0.5"

follow-redirects@^1.15.1:
version "1.15.3"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a"
integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==

follow-redirects@^1.15.4:
version "1.15.4"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.4.tgz#cdc7d308bf6493126b17ea2191ea0ccf3e535adf"
Expand Down

0 comments on commit 899150e

Please sign in to comment.