Skip to content

Commit

Permalink
Pass max size to task easy queues (#55)
Browse files Browse the repository at this point in the history
* Pass max size to task easy queues

* 1.2.5
  • Loading branch information
Mudrekh authored and cmseaton42 committed Sep 3, 2019
1 parent def4e93 commit a5788f3
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 18 deletions.
43 changes: 31 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethernet-ip",
"version": "1.2.4",
"version": "1.2.5",
"description": "A simple node interface for Ethernet/IP.",
"main": "./src/index.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/controller/controller.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ describe("Controller Class", () => {

expect(plc.time).toMatchSnapshot();
});

it("Task Easy", () => {
const plc = new Controller({ queue_max_size: 200 });
expect(plc.workers.read.max).toEqual(200);
});
});
});
10 changes: 5 additions & 5 deletions src/controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const compare = (obj1, obj2) => {
};

class Controller extends ENIP {
constructor() {
constructor({ queue_max_size } = {}) {
super();

this.state = {
...this.state,
controller: {
Expand All @@ -37,9 +37,9 @@ class Controller extends ENIP {
};

this.workers = {
read: new Queue(compare),
write: new Queue(compare),
group: new Queue(compare)
read: new Queue(compare, queue_max_size),
write: new Queue(compare, queue_max_size),
group: new Queue(compare, queue_max_size)
};
}

Expand Down

0 comments on commit a5788f3

Please sign in to comment.