Skip to content

Commit

Permalink
fix: fix retry when icon build fails
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Aug 13, 2024
1 parent 3e7b475 commit d628031
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions extension/build/make-icon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { retryAsync } from 'ts-retry'
import { waitUntilAsync, retryAsync } from 'ts-retry'
import fs from 'node:fs/promises'
import path from 'node:path'

Expand Down Expand Up @@ -34,14 +34,16 @@ export let makeIcon = async (
await retryAsync(
async () => {
console.log(`Making icon: ${icon.id}`)
try {
await fs.writeFile(
path.join(config.tmpDir, fileName),
await colorize(icon.id, theme, source),
)
} catch (error) {
console.log(`Error making icon: ${icon.id}`, error)
}

await waitUntilAsync(async () => {
try {
let colorized = await colorize(icon.id, theme, source)
await fs.writeFile(path.join(config.tmpDir, fileName), colorized)
} catch (error) {
console.log(`Error making icon: ${icon.id}`, error)
throw error
}
}, 3000)
},
{
delay: 100,
Expand Down

0 comments on commit d628031

Please sign in to comment.