mirror of
https://github.com/tiennm99/claude-status-webhook.git
synced 2026-04-17 15:20:37 +00:00
refactor: rename queue to claude-status and remove KV key prefix
Namespace provides scoping, prefix on KV key is redundant.
This commit is contained in:
@@ -41,7 +41,7 @@ Cloudflare Workers with two entry points exported from `src/index.js`:
|
|||||||
|
|
||||||
### KV Storage
|
### 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"] }`
|
- DM/group: `"chatId"` → `{ types: ["incident", "component"] }`
|
||||||
- Supergroup topic: `"chatId:threadId"` → `{ types: ["incident"] }`
|
- 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)
|
## CF Bindings (wrangler.jsonc)
|
||||||
|
|
||||||
- `SUBSCRIBERS` — KV namespace
|
- `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)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ npx wrangler login
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx wrangler kv namespace create SUBSCRIBERS
|
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`:
|
Copy the KV namespace ID from the output and update `wrangler.jsonc`:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
const KV_KEY = "claude-status:subscribers";
|
const KV_KEY = "subscribers";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build composite key: "chatId" or "chatId:threadId" for supergroup topics
|
* Build composite key: "chatId" or "chatId:threadId" for supergroup topics
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
],
|
],
|
||||||
"queues": {
|
"queues": {
|
||||||
"producers": [
|
"producers": [
|
||||||
{ "binding": "STATUS_QUEUE", "queue": "status-notifications" }
|
{ "binding": "STATUS_QUEUE", "queue": "claude-status" }
|
||||||
],
|
],
|
||||||
"consumers": [
|
"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`):
|
// Secrets (set via `wrangler secret put`):
|
||||||
|
|||||||
Reference in New Issue
Block a user