mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-20 07:10:02 +00: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.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
import { Analytics } from '@hcengineering/analytics'
|
||||||
import core, {
|
import core, {
|
||||||
ClassifierKind,
|
ClassifierKind,
|
||||||
DOMAIN_MODEL,
|
DOMAIN_MODEL,
|
||||||
@ -74,7 +75,6 @@ import type {
|
|||||||
TriggerControl
|
TriggerControl
|
||||||
} from '../types'
|
} from '../types'
|
||||||
import { SessionContextImpl, createBroadcastEvent } from '../utils'
|
import { SessionContextImpl, createBroadcastEvent } from '../utils'
|
||||||
import { Analytics } from '@hcengineering/analytics'
|
|
||||||
|
|
||||||
export class TServerStorage implements ServerStorage {
|
export class TServerStorage implements ServerStorage {
|
||||||
private readonly fulltext: FullTextIndex
|
private readonly fulltext: FullTextIndex
|
||||||
@ -749,7 +749,7 @@ export class TServerStorage implements ServerStorage {
|
|||||||
await this.broadcastCtx([{ derived: result }, ...applyCtx.derived])
|
await this.broadcastCtx([{ derived: result }, ...applyCtx.derived])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
setImmediate(() => {
|
setTimeout(() => {
|
||||||
void asyncTriggerProcessor()
|
void asyncTriggerProcessor()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -412,11 +412,11 @@ function createWebsocketClientSocket (
|
|||||||
ctx.measure('send-data', smsg.length)
|
ctx.measure('send-data', smsg.length)
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
const doSend = (): void => {
|
const doSend = (): void => {
|
||||||
if (ws.readyState !== ws.OPEN && !cs.isClosed) {
|
if (ws.readyState !== ws.OPEN || cs.isClosed) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (ws.bufferedAmount > 16 * 1024) {
|
if (ws.bufferedAmount > 16 * 1024) {
|
||||||
setImmediate(doSend)
|
setTimeout(doSend)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ws.send(smsg, { binary: true, compress: compression }, (err) => {
|
ws.send(smsg, { binary: true, compress: compression }, (err) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user