mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 21:50:34 +03:00
UBERF-7197: Fix high cpu load (#5761)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
56c3f7ed02
commit
9f9fcd9963
@ -14,6 +14,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import core, {
|
||||
ClassifierKind,
|
||||
DOMAIN_MODEL,
|
||||
@ -74,7 +75,6 @@ import type {
|
||||
TriggerControl
|
||||
} from '../types'
|
||||
import { SessionContextImpl, createBroadcastEvent } from '../utils'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
export class TServerStorage implements ServerStorage {
|
||||
private readonly fulltext: FullTextIndex
|
||||
@ -749,7 +749,7 @@ export class TServerStorage implements ServerStorage {
|
||||
await this.broadcastCtx([{ derived: result }, ...applyCtx.derived])
|
||||
})
|
||||
}
|
||||
setImmediate(() => {
|
||||
setTimeout(() => {
|
||||
void asyncTriggerProcessor()
|
||||
})
|
||||
}
|
||||
|
@ -412,11 +412,11 @@ function createWebsocketClientSocket (
|
||||
ctx.measure('send-data', smsg.length)
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const doSend = (): void => {
|
||||
if (ws.readyState !== ws.OPEN && !cs.isClosed) {
|
||||
if (ws.readyState !== ws.OPEN || cs.isClosed) {
|
||||
return
|
||||
}
|
||||
if (ws.bufferedAmount > 16 * 1024) {
|
||||
setImmediate(doSend)
|
||||
setTimeout(doSend)
|
||||
return
|
||||
}
|
||||
ws.send(smsg, { binary: true, compress: compression }, (err) => {
|
||||
|
Loading…
Reference in New Issue
Block a user