refs #5144 add minimum filter #4
|
@ -11,6 +11,10 @@ $ sudo npm install -g pino-pretty
|
||||||
Launch application in developer environment.
|
Launch application in developer environment.
|
||||||
```
|
```
|
||||||
$ npm run start
|
$ npm run start
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
$ npm run start | pino-pretty
|
||||||
```
|
```
|
||||||
|
|
||||||
For test.
|
For test.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
import con from '../connect.js';
|
||||||
|
|
||||||
|
export default async() => {
|
||||||
|
const [arcs] = await con.query(`SELECT id as arcId, printerFk, ip, minimum FROM vn.arcRead;`);
|
||||||
|
return arcs;
|
||||||
|
};
|
16
server.js
16
server.js
|
@ -1,15 +1,21 @@
|
||||||
import stream from './src/stream.js';
|
import stream from './src/stream.js';
|
||||||
import getConfig from './util/getConfig.js';
|
import getConfig from './util/getConfig.js';
|
||||||
import logger from 'pino';
|
import logger from 'pino';
|
||||||
|
import getArcs from './db/querys/getArcs.js';
|
||||||
|
|
||||||
console.logger = logger();
|
console.logger = logger();
|
||||||
|
|
||||||
function main() {
|
async function main(arcId) {
|
||||||
const conf = getConfig();
|
const conf = getConfig();
|
||||||
|
|
||||||
stream(conf, e => {
|
for (let arc of await getArcs()) {
|
||||||
console.logger.error(e);
|
const config = Object.assign({}, conf, arc);
|
||||||
setTimeout(main, conf.reconnectInterval);
|
if (arcId && arcId != arc.arcId) continue;
|
||||||
});
|
stream(config, e => {
|
||||||
|
console.logger.error(e);
|
||||||
|
setTimeout(main, config.reconnectInterval, config.arcId);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
|
@ -39,7 +39,8 @@ export default async(conf, cb) => {
|
||||||
function createPallet() {
|
function createPallet() {
|
||||||
clearTimeout(interval);
|
clearTimeout(interval);
|
||||||
|
|
||||||
newPallet(rfidbuffer, conf.arcId);
|
if (!conf.minimum || rfidbuffer.size > conf.minimum)
|
||||||
|
newPallet(rfidbuffer, conf.arcId);
|
||||||
|
|
||||||
rfidbuffer = new Set();
|
rfidbuffer = new Set();
|
||||||
rfidbufferExtend = [];
|
rfidbufferExtend = [];
|
||||||
|
|
Loading…
Reference in New Issue