Update worker limit (#1405)

* Update worker limit

* Handle error for when a mapping has no routes
This commit is contained in:
Neal Shah
2025-07-31 12:34:19 -07:00
committed by GitHub
parent 0f91503eb5
commit 3d227e0798
2 changed files with 5 additions and 2 deletions
@@ -198,8 +198,8 @@ class WorkerService extends BaseService {
const currentDomains = await svc_su.sudo(Context.get("actor").get_related_actor(UserActorType), async () => {
return (await es_subdomain.select({ predicate: new StartsWith({ key: "subdomain", value: "workers.puter." }) }));
});
if (currentDomains.length >= 10) {
throw APIError.create('subdomain_limit_reached', null, {isWorker: true, limit: 10});
if (currentDomains.length >= 100) {
throw APIError.create('subdomain_limit_reached', null, {isWorker: true, limit: 100});
}
if (this.global_config.reserved_words.includes(workerName)) {
@@ -78,6 +78,9 @@ function inits2w() {
if (this.handleCors && event.request.method === "OPTIONS" && !mappings) {
return this.handleOptions(event.request);
}
if (!mappings) {
return new Response(`No routes for given request type ${event.request.method}`, {status: 404});
}
const url = new URL(event.request.url);
try {
for (const mapping of mappings) {