mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-26 07:06:08 +00:00
Update worker limit (#1405)
* Update worker limit * Handle error for when a mapping has no routes
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user