summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-06-21 20:45:03 +0200
committerRory& <root@rory.gay>2026-06-21 20:45:03 +0200
commit1013bfd5b21c07af81eb9b763c3c06f0b381c8ad (patch)
treebc05c259bdef59aeca1e9ec511156427c71fcd5e /src
parentUse stopwatch for LazyRequest, clean up imports, remove unused code (diff)
downloadserver-ts-1013bfd5b21c07af81eb9b763c3c06f0b381c8ad.tar.xz
LazyRequest: support offload
Diffstat (limited to 'src')
-rw-r--r--src/gateway/opcodes/LazyRequest.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gateway/opcodes/LazyRequest.ts b/src/gateway/opcodes/LazyRequest.ts

index e4c9bcaf..410c265f 100644 --- a/src/gateway/opcodes/LazyRequest.ts +++ b/src/gateway/opcodes/LazyRequest.ts
@@ -19,9 +19,9 @@ import murmur from "murmurhash-js/murmurhash3_gc"; import { getDatabase, Member, Role, Session, User, Channel } from "@spacebar/database"; import { arrayPartition, Stopwatch } from "@spacebar/extensions"; -import { WebSocket, Payload, handlePresenceUpdate, OPCODES, Send } from "@spacebar/gateway"; +import { WebSocket, Payload, handlePresenceUpdate, OPCODES, Send, handleOffloadedGatewayRequest } from "@spacebar/gateway"; import { LazyRequestSchema } from "@spacebar/schemas"; -import { getPermission, listenEvent, Presence, Permissions, getMostRelevantSession } from "@spacebar/util"; +import { getPermission, listenEvent, Presence, Permissions, getMostRelevantSession, Config } from "@spacebar/util"; import { check } from "./instanceOf"; import { start } from "node:repl"; @@ -158,6 +158,10 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) { // noinspection JSUnusedLocalSymbols - TODO: implement typing/activities subscriptions const { guild_id, typing, channels, activities, members } = d as LazyRequestSchema; + if (Config.get().offload.gateway.lazyRequestUrl !== null) { + return await handleOffloadedGatewayRequest(this, Config.get().offload.gateway.lazyRequestUrl!, d); + } + if (members) { // Client has requested a PRESENCE_UPDATE for specific member