feat: Introduce a 10ms delay to sendSsoCmdReqByContend and cache prepareUpload requests
This commit is contained in:
2 files changed
+9
-3
No files matched your search
@@ -4,6 +4,7 @@ import WebSocket, { Data } from "ws";
|
||||
import crypto, { createHash } from "crypto";
|
||||
import { NapCatCore } from "@/core";
|
||||
import { PacketHexStr } from "@/core/packet/packer";
|
||||
import {sleep} from "@/common/helper";
|
||||
|
||||
export interface RecvPacket {
|
||||
type: string, // 仅recv
|
||||
@@ -171,6 +172,7 @@ export class PacketClient {
|
||||
const md5 = crypto.createHash('md5').update(data).digest('hex');
|
||||
const trace_id = (this.randText(4) + md5 + data).slice(0, data.length / 2);
|
||||
this.sendCommand(cmd, data, trace_id, rsp, 20000, async () => {
|
||||
await sleep(10);
|
||||
await this.napCatCore.context.session.getMsgService().sendSsoCmdReqByContend(cmd, trace_id);
|
||||
}).then((res) => resolve(res)).catch((e: Error) => reject(e));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user