Tweak socket work cadence

This commit is contained in:
Jonathan Staab
2023-07-20 10:18:16 -07:00
parent 5cbb229708
commit e9d7ad166e
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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
View File
@@ -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
} }
} }
} }