From 4db71a6c0dd4ee9c8d2b4e3ce54c23f04c5e738e Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 16 Jun 2022 13:40:48 -0500 Subject: [PATCH] merge read and write queues Sometimes with high volumes of reads and writes, the values will start swapping around if the queues remain separate --- src/controller/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/controller/index.js b/src/controller/index.js index 1bfe715..228df57 100644 --- a/src/controller/index.js +++ b/src/controller/index.js @@ -37,8 +37,7 @@ class Controller extends ENIP { }; this.workers = { - read: new Queue(compare, queue_max_size), - write: new Queue(compare, queue_max_size), + readWrite: new Queue(compare, queue_max_size), group: new Queue(compare, queue_max_size) }; } @@ -336,7 +335,7 @@ class Controller extends ENIP { * @memberof Controller */ readTag(tag, size = null) { - return this.workers.read.schedule(this._readTag.bind(this), [tag, size], { + return this.workers.readWrite.schedule(this._readTag.bind(this), [tag, size], { priority: 1, timestamp: new Date() }); @@ -352,7 +351,7 @@ class Controller extends ENIP { * @memberof Controller */ writeTag(tag, value = null, size = 0x01) { - return this.workers.write.schedule(this._writeTag.bind(this), [tag, value, size], { + return this.workers.readWrite.schedule(this._writeTag.bind(this), [tag, value, size], { priority: 1, timestamp: new Date() });