Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/build-infra/lib/github-releases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import { pRetry } from '@socketsecurity/lib/promises'

const logger = getDefaultLogger()

// Cache GitHub API responses for 1 hour to avoid rate limiting.
// Cache GitHub API responses for 4 hours to reduce API calls and avoid rate limiting.
const cache = createTtlCache({
memoize: true,
prefix: 'github-releases',
ttl: 60 * 60 * 1000, // 1 hour.
ttl: 4 * 60 * 60 * 1000, // 4 hours.
})

/**
Expand Down Expand Up @@ -155,8 +155,8 @@ export async function getLatestRelease(
return null
},
{
backoffFactor: 1,
baseDelayMs: 5_000,
backoffFactor: 2,
baseDelayMs: 3_000,
onRetry: (attempt, error) => {
if (!quiet) {
logger.info(
Expand Down Expand Up @@ -231,8 +231,8 @@ export async function getReleaseAssetUrl(
return asset.browser_download_url
},
{
backoffFactor: 1,
baseDelayMs: 5_000,
backoffFactor: 2,
baseDelayMs: 3_000,
onRetry: (attempt, error) => {
if (!quiet) {
logger.info(` Retry attempt ${attempt + 1}/3 for asset URL...`)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@socketsecurity/cli",
"version": "0.0.0-copied-from-packages-socket",
"version": "0.0.0",
"description": "CLI for Socket.dev",
"private": true,
"license": "MIT",
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/scripts/download-assets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ async function downloadAssets(assetNames, parallel = true) {
* Main entry point.
*/
async function main() {
// Skip downloads entirely when SKIP_ASSET_DOWNLOAD is set.
// Useful for repeated local builds where assets are already cached,
// or when GitHub API rate limits are exhausted.
if (process.env.SKIP_ASSET_DOWNLOAD) {
logger.info('Skipping asset downloads (SKIP_ASSET_DOWNLOAD is set)')
return
}

const args = process.argv.slice(2)
const parallel = !args.includes('--no-parallel')
const assetArgs = args.filter(arg => !arg.startsWith('--'))
Expand Down