From 41bdcf36ef4d8f7cc4cbd4e5e3d60b9626ab95f4 Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Wed, 8 Apr 2026 23:09:02 +0700 Subject: [PATCH] refactor: rename queue to claude-status and remove KV key prefix Namespace provides scoping, prefix on KV key is redundant. --- CLAUDE.md | 4 ++-- README.md | 2 +- src/kv-store.js | 2 +- wrangler.jsonc | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 4d75d01..14cfebb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,7 +41,7 @@ Cloudflare Workers with two entry points exported from `src/index.js`: ### KV Storage -Single key `claude-status:subscribers` stores a JSON object keyed by composite subscriber ID: +Single key `subscribers` stores a JSON object keyed by composite subscriber ID: - DM/group: `"chatId"` → `{ types: ["incident", "component"] }` - Supergroup topic: `"chatId:threadId"` → `{ types: ["incident"] }` @@ -60,4 +60,4 @@ Bot stores `message_thread_id` from the topic where `/start` was sent. Notificat ## CF Bindings (wrangler.jsonc) - `SUBSCRIBERS` — KV namespace -- `STATUS_QUEUE` — Queue producer/consumer (`status-notifications`, batch size 30, max retries 3) +- `STATUS_QUEUE` — Queue producer/consumer (`claude-status`, batch size 30, max retries 3) diff --git a/README.md b/README.md index a38e97e..9b15d40 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ npx wrangler login ```bash npx wrangler kv namespace create SUBSCRIBERS -npx wrangler queues create status-notifications +npx wrangler queues create claude-status ``` Copy the KV namespace ID from the output and update `wrangler.jsonc`: diff --git a/src/kv-store.js b/src/kv-store.js index a201db2..1a8beee 100644 --- a/src/kv-store.js +++ b/src/kv-store.js @@ -1,4 +1,4 @@ -const KV_KEY = "claude-status:subscribers"; +const KV_KEY = "subscribers"; /** * Build composite key: "chatId" or "chatId:threadId" for supergroup topics diff --git a/wrangler.jsonc b/wrangler.jsonc index 7b502c2..65f3fbe 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -7,10 +7,10 @@ ], "queues": { "producers": [ - { "binding": "STATUS_QUEUE", "queue": "status-notifications" } + { "binding": "STATUS_QUEUE", "queue": "claude-status" } ], "consumers": [ - { "queue": "status-notifications", "max_batch_size": 30, "max_retries": 3 } + { "queue": "claude-status", "max_batch_size": 30, "max_retries": 3 } ] } // Secrets (set via `wrangler secret put`):