mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&judge: allow concurrency setting within single connection
This commit is contained in:
2 files changed
+29
-12
No files matched your search
@@ -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) => {
|
||||
|
||||
Reference in new issue
Block a user