@jetit/publisher 3.2.0 → 3.2.1
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/lib/redis/streams.js +11 -4
package/package.json
CHANGED
package/src/lib/redis/streams.js
CHANGED
|
@@ -184,10 +184,17 @@ class Streams {
|
|
|
184
184
|
const processMessage = async (redisClient, messageId, processPending = false) => {
|
|
185
185
|
console.log(`PUBLISHER: Processing message ${messageId} for ${streamName}`);
|
|
186
186
|
try {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
try {
|
|
188
|
+
const pendingDetails = await redisClient.xpending(streamName, this.consumerGroupName, messageId, messageId, 1, this.instanceId);
|
|
189
|
+
if (pendingDetails[2] === 0) {
|
|
190
|
+
console.warn(`PUBLISHER: Message ${messageId} for ${streamName} already acknowledged.`);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
// Ignore the xpending error and continue
|
|
196
|
+
console.error('XPENDING ERROR: To be handled');
|
|
197
|
+
console.warn(JSON.stringify(e));
|
|
191
198
|
}
|
|
192
199
|
const messages = await redisClient.xrange(streamName, messageId, messageId);
|
|
193
200
|
if (messages && messages.length) {
|