@nomikos/module-comm 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/services/AmqpReceiver.js +14 -12
package/package.json
CHANGED
|
@@ -22,14 +22,14 @@ module.exports = {
|
|
|
22
22
|
setup: async (ch) => {
|
|
23
23
|
loggerRoot.debug("CREANDO CHANNEL PARA CONSUMIR");
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const prefetch = cola.prefetch || 1;
|
|
25
|
+
// Corregido para manejar y devolver promesas correctamente
|
|
26
|
+
return Promise.all(
|
|
27
|
+
Object.keys(colas).map(async (queueName) => {
|
|
28
|
+
const cola = colas[queueName];
|
|
29
|
+
const options = cola.options;
|
|
30
|
+
const prefetch = cola.prefetch || 1;
|
|
32
31
|
|
|
32
|
+
try {
|
|
33
33
|
// Uso correcto de promesas sin envolver en una nueva promesa innecesariamente
|
|
34
34
|
await ch.assertQueue(queueName, options);
|
|
35
35
|
if (
|
|
@@ -53,11 +53,13 @@ module.exports = {
|
|
|
53
53
|
ch.prefetch(prefetch);
|
|
54
54
|
amqpReceiverAdapter(ch, queueName, cola);
|
|
55
55
|
loggerRoot.debug(`COLA CONSUMO ${queueName}`);
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
} catch (error) {
|
|
57
|
+
loggerRoot.error(
|
|
58
|
+
`Error al configurar las colas: ${error.message}`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
); // end Promise.all
|
|
61
63
|
},
|
|
62
64
|
});
|
|
63
65
|
|