Skip to content

Commit fc32657

Browse files
committed
perf: switch to sharded adapter & dynamic subscription mode
1 parent 630a706 commit fc32657

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
services:
1717
redis:
18-
image: redislabs/rejson:latest
18+
image: redis/redis-stack-server:latest
1919
ports:
2020
- 6379:6379
2121
options: >-

Diff for: package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@koa/router": "^12.0.1",
1010
"@maxmind/geoip2-node": "^4.2.0",
1111
"@redocly/openapi-core": "^1.6.0",
12-
"@socket.io/redis-adapter": "^8.2.1",
12+
"@socket.io/redis-adapter": "github:MartinKolarik/socket.io-redis-adapter#dist",
1313
"adm-zip": "^0.5.10",
1414
"any-ascii": "^0.3.2",
1515
"bluebird": "^3.7.2",

Diff for: src/lib/ws/server.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type RemoteSocket, Server, Socket } from 'socket.io';
2-
import { createAdapter } from '@socket.io/redis-adapter';
2+
import { createShardedAdapter } from '@socket.io/redis-adapter';
33
// eslint-disable-next-line n/no-missing-import
44
import type { DefaultEventsMap } from 'socket.io/dist/typed-events.js';
55
import type { Probe } from '../../probe/types.js';
@@ -32,8 +32,8 @@ export const initWsServer = async () => {
3232
pingTimeout: 3000,
3333
});
3434

35-
io.adapter(createAdapter(pubClient, subClient, {
36-
publishOnSpecificResponseChannel: true,
35+
io.adapter(createShardedAdapter(pubClient, subClient, {
36+
subscriptionMode: 'dynamic',
3737
}));
3838
};
3939

0 commit comments

Comments
 (0)