@colyseus/core 0.18.16 → 0.18.17
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/build/MatchMaker.cjs +93 -10
- package/build/MatchMaker.cjs.map +3 -3
- package/build/MatchMaker.d.ts +20 -1
- package/build/MatchMaker.mjs +93 -11
- package/build/MatchMaker.mjs.map +3 -3
- package/build/Room.cjs.map +2 -2
- package/build/Room.mjs.map +2 -2
- package/build/matchmaker/LocalDriver/LocalDriver.cjs +14 -1
- package/build/matchmaker/LocalDriver/LocalDriver.cjs.map +2 -2
- package/build/matchmaker/LocalDriver/LocalDriver.d.ts +2 -0
- package/build/matchmaker/LocalDriver/LocalDriver.mjs +14 -1
- package/build/matchmaker/LocalDriver/LocalDriver.mjs.map +2 -2
- package/build/matchmaker/driver.cjs.map +1 -1
- package/build/matchmaker/driver.d.ts +11 -0
- package/build/matchmaker/driver.mjs.map +1 -1
- package/build/presence/LocalPresence.cjs +2 -0
- package/build/presence/LocalPresence.cjs.map +2 -2
- package/build/presence/LocalPresence.mjs +2 -0
- package/build/presence/LocalPresence.mjs.map +2 -2
- package/build/utils/DevMode.cjs +3 -0
- package/build/utils/DevMode.cjs.map +2 -2
- package/build/utils/DevMode.mjs +4 -1
- package/build/utils/DevMode.mjs.map +2 -2
- package/build/utils/Utils.cjs +6 -0
- package/build/utils/Utils.cjs.map +2 -2
- package/build/utils/Utils.d.ts +2 -0
- package/build/utils/Utils.mjs +4 -0
- package/build/utils/Utils.mjs.map +2 -2
- package/package.json +4 -4
- package/src/MatchMaker.ts +174 -16
- package/src/Room.ts +2 -1
- package/src/matchmaker/LocalDriver/LocalDriver.ts +15 -7
- package/src/matchmaker/driver.ts +12 -0
- package/src/presence/LocalPresence.ts +2 -0
- package/src/utils/DevMode.ts +4 -1
- package/src/utils/Utils.ts +6 -0
package/src/utils/DevMode.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import { type Schema, MapSchema, ArraySchema, SetSchema, CollectionSchema, $childType, $changes } from '@colyseus/schema';
|
|
4
4
|
import { logger } from '../Logger.ts';
|
|
5
5
|
import { debugAndPrintError, debugDevMode } from '../Debug.ts';
|
|
6
|
-
import { getLocalRoomById, handleCreateRoom, presence, remoteRoomCall } from '../MatchMaker.ts';
|
|
6
|
+
import { getLocalRoomById, handleCreateRoom, MatchMakerState, presence, remoteRoomCall, state } from '../MatchMaker.ts';
|
|
7
7
|
import type { Room } from '../Room.ts';
|
|
8
8
|
|
|
9
9
|
const DEVMODE_CACHE_FILE_PATH = path.resolve(".devmode.json");
|
|
@@ -49,6 +49,9 @@ export async function reloadFromCache() {
|
|
|
49
49
|
recreatedRoom = getLocalRoomById(recreatedRoomListing.roomId);
|
|
50
50
|
|
|
51
51
|
} catch (e: any) {
|
|
52
|
+
// shutdown interrupted the restore: keep the remaining entries for the next boot
|
|
53
|
+
if (state === MatchMakerState.SHUTTING_DOWN) { break; }
|
|
54
|
+
|
|
52
55
|
// unrestorable entry (e.g. room type renamed/removed) — drop it
|
|
53
56
|
// instead of wedging the boot
|
|
54
57
|
debugAndPrintError(`❌ couldn't restore room '${roomId}':\n${e.stack}`);
|
package/src/utils/Utils.ts
CHANGED
|
@@ -44,6 +44,12 @@ export type RemoteRoomCallReturn<
|
|
|
44
44
|
export const REMOTE_ROOM_SHORT_TIMEOUT = Number(process.env.COLYSEUS_PRESENCE_SHORT_TIMEOUT || 2000);
|
|
45
45
|
export const MAX_CONCURRENT_CREATE_ROOM_WAIT_TIME = Number(process.env.COLYSEUS_MAX_CONCURRENT_CREATE_ROOM_WAIT_TIME || 0.5);
|
|
46
46
|
|
|
47
|
+
// a peer that removes this process's room listings leaves a receipt. this
|
|
48
|
+
// process looks for it every INTERVAL (ms) and restores them. the TTL (seconds)
|
|
49
|
+
// only bounds what dead processes leave behind.
|
|
50
|
+
export const SWEPT_CHECK_INTERVAL = Number(process.env.COLYSEUS_SWEPT_CHECK_INTERVAL || 5000);
|
|
51
|
+
export const SWEPT_RECEIPT_TTL = Number(process.env.COLYSEUS_SWEPT_RECEIPT_TTL || 600);
|
|
52
|
+
|
|
47
53
|
/**
|
|
48
54
|
* The well-known `Symbol.metadata` (TC39 decorator metadata), falling back to the
|
|
49
55
|
* registered symbol on runtimes that don't expose it globally yet. `@colyseus/schema`
|