From 7ae4f094539f1738b936a79089b2e0657a3b338b Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 17 Apr 2024 17:01:13 +0200 Subject: [PATCH] fix: refs #4409 Code fixes --- README.md | 5 +++-- lib/queue-fk.js | 6 +++--- mycdc.js | 5 ++++- package.json | 2 +- queues/ticketTotal.yml | 4 ++-- queues/travelEntries.yml | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d522bc6..2b69786 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# MyCDC +# MyCDC - MySQL change data capture Application to run asynchronous operations based on DB changes. It is divided into three services: @@ -10,7 +10,7 @@ relevant messages to each RabbitMQ queue. - Consumer: Obtains the elements from the queues and performs the necessary operations asynchronously. -## Enviroment setup +## Environment setup Because a bug with MariaDB wich it's fix is pending to be merged into main project branch, a *zongji* fork must be cloned into project root directory. @@ -49,3 +49,4 @@ npm run consumer * [Zongji](https://github.com/nevill/zongji) * [MySQL2](https://github.com/sidorares/node-mysql2#readme) +* [RabbitMQ] (https://www.rabbitmq.com/) diff --git a/lib/queue-fk.js b/lib/queue-fk.js index 5f609ed..d241d1f 100644 --- a/lib/queue-fk.js +++ b/lib/queue-fk.js @@ -29,13 +29,13 @@ module.exports = class QueueFk extends Queue { async onFlushTimeout() { if (this.nMessages) { const {consumer} = this; - - if (consumer.conf.debug) - console.debug('Flush:'.blue, this.name.yellow, this.ids); const scopes = this.scopes; const lastMessage = this.lastMessage; this.reset(); + + if (consumer.conf.debug) + console.debug('Flush:'.blue, this.name.yellow, scopes); try { for (const [scope, ids] of scopes) { diff --git a/mycdc.js b/mycdc.js index ed408eb..9529672 100644 --- a/mycdc.js +++ b/mycdc.js @@ -318,7 +318,10 @@ module.exports = class MyCDC { case 'rotate': this.filename = evt.binlogName; position = evt.position; - console.log(`[${eventName}] filename: ${this.filename}`, `position: ${this.position}, nextPosition: ${evt.nextPosition}`); + console.log( + `[${eventName}] filename: ${this.filename}`, + `position: ${this.position}, nextPosition: ${evt.nextPosition}` + ); break; case 'writerows': case 'deleterows': diff --git a/package.json b/package.json index ac6f0c3..cd11a22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mycdc", - "version": "0.0.9", + "version": "0.0.10", "author": "Verdnatura Levante SL", "description": "Asynchronous DB calculations reading the binary log", "license": "GPL-3.0", diff --git a/queues/ticketTotal.yml b/queues/ticketTotal.yml index 3517035..2128d8c 100644 --- a/queues/ticketTotal.yml +++ b/queues/ticketTotal.yml @@ -1,7 +1,7 @@ query: ticket: CALL vn.ticket_recalc(:id, NULL) - client: CALL vn.ticket_recalcByScope(:table, :id) - address: CALL vn.ticket_recalcByScope(:table, :id) + client: CALL vn.ticket_recalcByScope('client', :id) + address: CALL vn.ticket_recalcByScope('address', :id) includeSchema: vn: ticket: diff --git a/queues/travelEntries.yml b/queues/travelEntries.yml index f56ad2d..3ff4380 100644 --- a/queues/travelEntries.yml +++ b/queues/travelEntries.yml @@ -6,4 +6,4 @@ includeSchema: key: travelFk scope: travel columns: - - travelfk + - travelFk