INNER CODE UNIT · JavaScript
Promise
cporter202/agentic-ai-apis · settings/fetch_apify_actors.js:98
await new Promise((resolve) => setTimeout(resolve, 500));
} catch (error) {
console.error(`Error fetching actors at offset ${offset}: ${error.message}`);
console.log('Retrying in 5 seconds...');
await new Promise((resolve) => setTimeout(resolve, 5000));
}
}
return allActors;
}
function saveToJSON(actors, filename = 'apify_actors.json') {
const filePath = path.join(__dirname, '..', filename);
fs.writeFileSync(filePath, JSON.stringify(actors, null, 2), 'utf-8');
console.log(`Saved ${actors.length} actors to ${filename}`);
}
async function main() {