core&judge: allow concurrency setting within single connection

This commit is contained in:
undefined committed 2023-11-27 23:59:02 +08:00
1 parent b122a2bda9
commit 599a177f46
2 files changed
+29 -12

No files matched your search

+5 -2
View File
@@ -178,8 +178,11 @@ export default class Hydro {
Authorization: `Bearer ${this.config.cookie.split('sid=')[1].split(';')[0]}`,
},
});
const content = this.config.minPriority !== undefined
? `{"key":"prio","prio":${this.config.minPriority}}`
const config: { prio?: number, concurrency?: number } = {};
if (this.config.minPriority !== undefined) config.prio = this.config.minPriority;
if (this.config.concurrency !== undefined) config.concurrency = this.config.concurrency;
const content = Object.keys(config).length
? JSON.stringify({ key: 'config', ...config })
: '{"key":"ping"}';
setInterval(() => this.ws?.send?.(content), 30000);
this.ws.on('message', (data) => {