diff --git a/src/index.ts b/src/index.ts index 35a2a6f..2e34f0c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { Hono } from "hono"; const INSTANCE_COUNT = 2; -export class MiniRuntimeContainer extends Container { +export class MiniRuntimeContainerMotleyFool extends Container { // Port the container listens on (default: 8080) defaultPort = 8080; // Time before container sleeps due to inactivity (default: 30s) @@ -40,8 +40,8 @@ export class MiniRuntimeContainer extends Container { // Create Hono app with proper typing for Cloudflare Workers type Environment = { - readonly MINI_RUNTIME_CONTAINER: DurableObjectNamespace - readonly AKTO_TRAFFIC_QUEUE: Queue + readonly MINI_RUNTIME_CONTAINER_MOTLEY_FOOL: DurableObjectNamespace + readonly AKTO_TRAFFIC_QUEUE_MOTLEY_FOOL: Queue } const app = new Hono<{ Bindings: Environment; @@ -101,9 +101,9 @@ export default { const normalized = normalizeBatchData({ batchData: payload }) const result = JSON.stringify(normalized) - const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER, INSTANCE_COUNT) - const containerId = env.MINI_RUNTIME_CONTAINER.idFromName(`/container/${containerInstance}`) - const container = env.MINI_RUNTIME_CONTAINER.get(containerId) + const containerInstance = getRandom(env.MINI_RUNTIME_CONTAINER_MOTLEY_FOOL, INSTANCE_COUNT) + const containerId = env.MINI_RUNTIME_CONTAINER_MOTLEY_FOOL.idFromName(`/container/${containerInstance}`) + const container = env.MINI_RUNTIME_CONTAINER_MOTLEY_FOOL.get(containerId) const req = new Request("http://internal/upload", { method: "POST", @@ -126,14 +126,14 @@ export default { // 🔒 requeue each message one by one before next batch for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_MOTLEY_FOOL.send(m.body) } } } catch (err) { console.error("Error sending messages to container:", err) for (const m of batchSlice) { - await env.AKTO_TRAFFIC_QUEUE.send(m.body) + await env.AKTO_TRAFFIC_QUEUE_MOTLEY_FOOL.send(m.body) } } } diff --git a/wrangler.jsonc b/wrangler.jsonc index 0c62051..d270df9 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,7 +4,7 @@ */ { "$schema": "node_modules/wrangler/config-schema.json", - "name": "mini-runtime-worker", + "name": "mini-runtime-worker-motley-fool", "main": "src/index.ts", "compatibility_date": "2025-05-23", "compatibility_flags": [ @@ -15,25 +15,25 @@ }, "containers": [ { - "class_name": "MiniRuntimeContainer", + "class_name": "MiniRuntimeContainerMotleyFool", "image": "registry.cloudflare.com/53a10bdb35f546522193c9670ad3e7e5/mr:nayan", "max_instances": 2, "instance_type": "standard", - "name": "mini-runtime-containers" + "name": "mini-runtime-containers-motley-fool" } ], "durable_objects": { "bindings": [ { - "class_name": "MiniRuntimeContainer", - "name": "MINI_RUNTIME_CONTAINER" + "class_name": "MiniRuntimeContainerMotleyFool", + "name": "MINI_RUNTIME_CONTAINER_MOTLEY_FOOL" } ] }, "queues": { "consumers": [ { - "queue": "akto-traffic-queue", + "queue": "akto-traffic-queue-motley-fool", "max_batch_size": 5, "max_batch_timeout": 30, "max_retries": 3, @@ -43,7 +43,7 @@ "migrations": [ { "new_sqlite_classes": [ - "MiniRuntimeContainer" + "MiniRuntimeContainerMotleyFool" ], "tag": "v1" }