Tweak socket work cadence
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paravel",
|
"name": "paravel",
|
||||||
"version": "0.1.18",
|
"version": "0.1.19",
|
||||||
"description": "Yet another toolkit for nostr",
|
"description": "Yet another toolkit for nostr",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
+2
-2
@@ -93,7 +93,7 @@ export class Socket extends EventEmitter {
|
|||||||
doWork = () => {
|
doWork = () => {
|
||||||
this.timeout = undefined
|
this.timeout = undefined
|
||||||
|
|
||||||
for (const [action, payload] of this.queue.splice(0, 50)) {
|
for (const [action, payload] of this.queue.splice(0, 10)) {
|
||||||
if (action === 'receive') {
|
if (action === 'receive') {
|
||||||
this.receiveMessage(payload)
|
this.receiveMessage(payload)
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ export class Socket extends EventEmitter {
|
|||||||
}
|
}
|
||||||
enqueueWork = () => {
|
enqueueWork = () => {
|
||||||
if (!this.timeout && this.queue.length > 0) {
|
if (!this.timeout && this.queue.length > 0) {
|
||||||
this.timeout = setTimeout(() => this.doWork(), 50) as NodeJS.Timeout
|
this.timeout = setTimeout(() => this.doWork(), 100) as NodeJS.Timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user