@cloudhal/cloudflare 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/admin-worker.js +18 -2
- package/package.json +10 -10
package/dist/src/admin-worker.js
CHANGED
|
@@ -258,6 +258,22 @@ function required(env , key ) {
|
|
|
258
258
|
return value;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
+
/** How often one isolate sweeps due comment purges on an admin request. */
|
|
262
|
+
const COMMENTS_SWEEP_MS = 10_000;
|
|
263
|
+
/** When this isolate last swept them; a plain number (ADR-0012: no objects between requests). */
|
|
264
|
+
let commentsSweptAt = 0;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Whether this request sweeps due comment purges. Each sweep reads D1, which serves one query at
|
|
268
|
+
* a time, so sweeping on every request slowed the screen's own calls; moderation still wakes its
|
|
269
|
+
* own flush.
|
|
270
|
+
*/
|
|
271
|
+
function commentsSweepDue(now = Date.now()) {
|
|
272
|
+
if (now - commentsSweptAt <= COMMENTS_SWEEP_MS) return false;
|
|
273
|
+
commentsSweptAt = now;
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
|
|
261
277
|
export function createAdminWorker(options = {}) {
|
|
262
278
|
const skills = (options.skills ?? []).map((s) => skillFromSource(s));
|
|
263
279
|
// Checked once per isolate; `cloudhal deploy` refused invalid types before uploading.
|
|
@@ -357,8 +373,8 @@ export function createAdminWorker(options = {}) {
|
|
|
357
373
|
}
|
|
358
374
|
: {}),
|
|
359
375
|
});
|
|
360
|
-
// Every admin request also flushes what is due (Studio polls every 15–60 s).
|
|
361
|
-
if (comments) ctx.waitUntil(flush());
|
|
376
|
+
// Every admin request also flushes what is due (Studio polls every 15–60 s), throttled.
|
|
377
|
+
if (comments && commentsSweepDue()) ctx.waitUntil(flush());
|
|
362
378
|
const store = new SiteGraphStore({
|
|
363
379
|
sql,
|
|
364
380
|
blobs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudhal/cloudflare",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.11",
|
|
4
4
|
"description": "Cloudhal on Cloudflare: the admin Worker (API, auth, MCP, Studio) over D1 + R2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://cloudhal.dev",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
"README.md"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cloudhal/agent-runtime": "0.3.
|
|
52
|
-
"@cloudhal/analytics": "0.3.
|
|
53
|
-
"@cloudhal/api": "0.3.
|
|
54
|
-
"@cloudhal/comments": "0.3.
|
|
55
|
-
"@cloudhal/core-ts": "0.3.
|
|
56
|
-
"@cloudhal/mcp-server": "0.3.
|
|
57
|
-
"@cloudhal/schedules": "0.3.
|
|
58
|
-
"@cloudhal/storage": "0.3.
|
|
51
|
+
"@cloudhal/agent-runtime": "0.3.11",
|
|
52
|
+
"@cloudhal/analytics": "0.3.11",
|
|
53
|
+
"@cloudhal/api": "0.3.11",
|
|
54
|
+
"@cloudhal/comments": "0.3.11",
|
|
55
|
+
"@cloudhal/core-ts": "0.3.11",
|
|
56
|
+
"@cloudhal/mcp-server": "0.3.11",
|
|
57
|
+
"@cloudhal/schedules": "0.3.11",
|
|
58
|
+
"@cloudhal/storage": "0.3.11",
|
|
59
59
|
"zod": "^4.6.5"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@cloudflare/workers-types": "^5.20261007.1",
|
|
63
|
-
"@cloudhal/astro-renderer": "0.3.
|
|
63
|
+
"@cloudhal/astro-renderer": "0.3.11",
|
|
64
64
|
"@types/node": "^26.6.5",
|
|
65
65
|
"typescript": "7.0.2",
|
|
66
66
|
"vitest": "5.0.3",
|