Commit 6b369c71 authored by Chunchi Che's avatar Chunchi Che

remove sleep operation in WebSocketStream

parent 9bed36f5
Pipeline #27218 passed with stages
in 7 minutes and 53 seconds
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
// //
// 因此封装了一个`WebSocketStream`类,当每次Websocket连接中有消息到达时,往流中添加event, // 因此封装了一个`WebSocketStream`类,当每次Websocket连接中有消息到达时,往流中添加event,
import { useConfig } from "@/config";
import { sleep } from "./sleep";
// 同时执行器会不断地从流中获取event进行处理。 // 同时执行器会不断地从流中获取event进行处理。
export class WebSocketStream { export class WebSocketStream {
public ws: WebSocket; public ws: WebSocket;
...@@ -69,7 +65,11 @@ export class WebSocketStream { ...@@ -69,7 +65,11 @@ export class WebSocketStream {
if (value) { if (value) {
// wait some time, and then handle message from server // wait some time, and then handle message from server
await sleep(useConfig().streamInterval); //
// but now it seems that we don't need wait any more,
// so comment the following line and check if it's ok without it.
//
// await sleep(useConfig().streamInterval);
await onMessage(value); await onMessage(value);
} else { } else {
console.warn("value from ReadableStream is undefined!"); console.warn("value from ReadableStream is undefined!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment