crawl-with-rate-limits-and-backoff
Use when running a crawler or hitting an API in bulk. Applies polite pacing, bounded concurrency, and exponential backoff so the source stays healthy.
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- crawl-with-rate-limits-and-backoff
- description
- Use when running a crawler or hitting an API in bulk. Applies polite pacing, bounded concurrency, and exponential backoff so the source stays healthy.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md360 B
- 参考文档TRUST.auto.yaml2.1 KB
03 SKILL.md 正文
Crawl With Rate Limits and Backoff
A crawler that ignores pacing gets itself blocked, degrades the target, and produces a partial dataset you mistake for a complete one.
Procedure
- Cap concurrency low: at most 2–4 simultaneous connections per host. Global parallelism of 50 against one server is a denial-of-service in miniature.
- Enforce a minimum delay per host, e.g. 1 request every 0.5–2 s, and respect
Crawl-delayif robots.txt sets a larger one. - Honour
Retry-Afterexactly on 429/503. Never retry sooner and never treat a 429 as success. - Back off exponentially with jitter on 5xx/timeouts:
import time, random def backoff(attempt): return min(60, 2**attempt) * (0.5 + random.random()) - Retry a bounded number of times (3–5), then record the URL as failed and move on. Infinite retries on a dead endpoint waste the whole budget.
- Cache every response to disk keyed by URL hash; on re-runs read the cache so you never re-hit the source:
import hashlib, pathlib key = hashlib.sha1(url.encode()).hexdigest() path = pathlib.Path("cache")/key - Track progress in an append-only log with status per URL, so a crash resumes instead of restarting from zero.
# smallest polite pattern: one request, sleep, one request
for u in "${urls[@]}"; do curl -s "$u" -o "out/$(echo "$u"|md5).html"; sleep 1; done
Pitfalls
- Counters that resume mid-run often double-count or skip; key the state on URL, not on array index.
- Rotating proxies to evade a rate limit is evasion, not politeness — see the robots/ToS skill.
- A 200 response can still be a soft block (a challenge page); validate the body, not just the status.
- Long sleeps without a timeout can hang a worker forever; add a hard per-request timeout.
- Retrying a non-idempotent POST duplicates writes; only auto-retry GETs.
Verification
grep -cE '429|503' crawl.log; grep -c 'FAILED' crawl.log
No unresolved 429s remain and failed URLs are a named, bounded set. Report: "Crawled 12,480 URLs at 2 conns/host, 1 s delay; 7 permanent failures logged; cache hit on re-run: 100%."
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.