@chaos-overlords/worker 0.9.0 → 0.9.1
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/package.json +8 -8
- package/src/MatchHub.ts +16 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaos-overlords/worker",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Cloudflare Workers runtime facade: the shared Hono app over D1, with one Durable Object per match for SSE fan-out and turn-deadline alarms.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chaos-overlords",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"provenance": true
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@chaos-overlords/bug-reports": "0.9.
|
|
51
|
-
"@chaos-overlords/contracts": "0.9.
|
|
52
|
-
"@chaos-overlords/kernel": "0.9.
|
|
53
|
-
"@chaos-overlords/server": "0.9.
|
|
54
|
-
"@chaos-overlords/storage": "0.9.
|
|
50
|
+
"@chaos-overlords/bug-reports": "0.9.1",
|
|
51
|
+
"@chaos-overlords/contracts": "0.9.1",
|
|
52
|
+
"@chaos-overlords/kernel": "0.9.1",
|
|
53
|
+
"@chaos-overlords/server": "0.9.1",
|
|
54
|
+
"@chaos-overlords/storage": "0.9.1",
|
|
55
55
|
"drizzle-orm": "^0.45.2",
|
|
56
56
|
"hono": "^4.13.8"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@chaos-overlords/client": "0.9.
|
|
60
|
-
"@chaos-overlords/conformance": "0.9.
|
|
59
|
+
"@chaos-overlords/client": "0.9.1",
|
|
60
|
+
"@chaos-overlords/conformance": "0.9.1",
|
|
61
61
|
"@cloudflare/vitest-pool-workers": "^0.22.0",
|
|
62
62
|
"@cloudflare/workers-types": "^5.20260920.1",
|
|
63
63
|
"typescript": "^7.0.2",
|
package/src/MatchHub.ts
CHANGED
|
@@ -3,7 +3,11 @@ import {
|
|
|
3
3
|
type MultiplayerStorage,
|
|
4
4
|
type PersistedEvent,
|
|
5
5
|
} from '@chaos-overlords/kernel'
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_EVENT_HUB_LIMITS,
|
|
8
|
+
DEFAULT_SERVER_CONFIG,
|
|
9
|
+
LocalEventHub,
|
|
10
|
+
} from '@chaos-overlords/server'
|
|
7
11
|
import { createSqliteStorage, sqliteSchema } from '@chaos-overlords/storage/sqlite'
|
|
8
12
|
import type { DurableObjectState } from '@cloudflare/workers-types'
|
|
9
13
|
import { drizzle } from 'drizzle-orm/d1'
|
|
@@ -31,7 +35,17 @@ export class MatchHub {
|
|
|
31
35
|
private readonly env: Env,
|
|
32
36
|
) {
|
|
33
37
|
this.repositories = createSqliteStorage(drizzle(env.DB, { schema: sqliteSchema }))
|
|
34
|
-
this.hub = new LocalEventHub(
|
|
38
|
+
this.hub = new LocalEventHub(
|
|
39
|
+
this.repositories.events,
|
|
40
|
+
DEFAULT_SERVER_CONFIG.sseHeartbeatMs,
|
|
41
|
+
DEFAULT_EVENT_HUB_LIMITS,
|
|
42
|
+
{
|
|
43
|
+
// The request signal here is the Worker's fetch into this object, not the client's own,
|
|
44
|
+
// so a run of these is where a signal that only looks aborted would show up.
|
|
45
|
+
abandoned: (matchId, playerId) =>
|
|
46
|
+
workerLogger.info('answered an already abandoned event stream', { matchId, playerId }),
|
|
47
|
+
},
|
|
48
|
+
)
|
|
35
49
|
}
|
|
36
50
|
|
|
37
51
|
async fetch(request: Request): Promise<Response> {
|