Agent skill
flyio-rate-limits
Handle Fly.io Machines API rate limits with backoff, concurrency control, and request batching for machine management operations. Trigger: "fly.io rate limit", "fly.io 429", "fly.io throttling", "machines API limit".
Install this agent skill to your Project
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/main/plugins/saas-packs/flyio-pack/skills/flyio-rate-limits
SKILL.md
Fly.io Rate Limits
Overview
The Fly.io Machines API has rate limits per organization. Machine create/update/delete operations are more tightly limited than read operations. The API returns 429 with Retry-After header when limits are exceeded.
Key Limits
| Operation | Approximate Limit | Scope |
|---|---|---|
| Machine create/delete | ~10/minute | Per org |
| Machine start/stop | ~30/minute | Per org |
| List/get machines | ~60/minute | Per org |
| App operations | ~20/minute | Per org |
Instructions
Retry with Exponential Backoff
async function flyApiWithRetry<T>(
fn: () => Promise<Response>,
maxRetries = 4
): Promise<T> {
for (let attempt = 0; attempt <= maxRetries; attempt++) {
const res = await fn();
if (res.ok) return res.json();
if (res.status === 429) {
const retryAfter = parseInt(res.headers.get('Retry-After') || '10');
const delay = retryAfter * 1000 + Math.random() * 2000;
console.log(`Rate limited. Retry in ${(delay / 1000).toFixed(0)}s`);
await new Promise(r => setTimeout(r, delay));
continue;
}
if (res.status >= 500 && attempt < maxRetries) {
await new Promise(r => setTimeout(r, Math.pow(2, attempt) * 1000));
continue;
}
throw new Error(`Fly API ${res.status}: ${await res.text()}`);
}
throw new Error('Max retries exceeded');
}
Batch Machine Operations
import PQueue from 'p-queue';
// Limit concurrent machine operations
const flyQueue = new PQueue({ concurrency: 3, interval: 10000, intervalCap: 10 });
async function batchCreateMachines(configs: Array<{ region: string; config: any }>) {
return Promise.all(
configs.map(c => flyQueue.add(() =>
flyApiWithRetry(() => fetch(`${FLY_API}/v1/apps/${app}/machines`, {
method: 'POST', headers,
body: JSON.stringify(c),
}))
))
);
}
Resources
Next Steps
For security, see flyio-security-basics.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dockerfile-generator
Dockerfile Generator - Auto-activating skill for DevOps Basics. Triggers on: dockerfile generator, dockerfile generator Part of the DevOps Basics skill category.
branch-naming-helper
Branch Naming Helper - Auto-activating skill for DevOps Basics. Triggers on: branch naming helper, branch naming helper Part of the DevOps Basics skill category.
readme-generator
Readme Generator - Auto-activating skill for DevOps Basics. Triggers on: readme generator, readme generator Part of the DevOps Basics skill category.
makefile-generator
Makefile Generator - Auto-activating skill for DevOps Basics. Triggers on: makefile generator, makefile generator Part of the DevOps Basics skill category.
gitignore-generator
Gitignore Generator - Auto-activating skill for DevOps Basics. Triggers on: gitignore generator, gitignore generator Part of the DevOps Basics skill category.
pre-commit-hook-setup
Pre Commit Hook Setup - Auto-activating skill for DevOps Basics. Triggers on: pre commit hook setup, pre commit hook setup Part of the DevOps Basics skill category.
Didn't find tool you were looking for?