Caddy: ACME account email (expiry notices, ZeroSSL fallback); regions: batch-sized first

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Saty 2026-10-20 03:06:33 +02:00
commit 75e16d4ea2
2 changed files with 6 additions and 1 deletions

View file

@ -4,6 +4,8 @@
{
admin off
# The ACME account: expiry notices, and ZeroSSL (the fallback issuer) requires one.
email admin@saty.dev
}
saty.dev {

View file

@ -69,7 +69,10 @@ export class Regions {
if (free && !g.free) continue;
out.push(g);
}
out.sort((a, b) => Number(b.free) - Number(a.free) || a.claimedBy.length - b.claimedBy.length || b.open - a.open || a.key.localeCompare(b.key));
// A good region is one agent's batch: 5 to 80 open functions first, then bigger ones (share
// them, or take them in parts), then the tiny ones.
const size = (g) => (g.open >= 5 && g.open <= 80 ? 0 : g.open > 80 ? 1 : 2);
out.sort((a, b) => Number(b.free) - Number(a.free) || a.claimedBy.length - b.claimedBy.length || size(a) - size(b) || b.open - a.open || a.key.localeCompare(b.key));
return { total: out.length, regions: out.slice(0, Math.min(Math.max(1, limit | 0), 1000)) };
}