We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2 issues:
Please find amended version of _write() and _final() below
async _write(obj, enc, cb) { this.emit('msgReceived', obj); try { if (!this.queueUrl) { await this.getQueueUrl(); }
// construct message const sqsMsg = _.clone(obj); if (obj.Id && obj.MessageBody) { this.buffer.push(sqsMsg); } else { const msg = { MessageBody: JSON.stringify(obj), Id: uuidv4() }; if (this.options.MessageGroupId) { msg.MessageGroupId = this.options.MessageGroupId; } this.buffer.push(msg); } // send message by batch if (this.buffer.length >= this.options.batchSize) { console.log("_write() - sending sqs message: " + JSON.stringify(this.buffer)); await this.sqs.sendMessageBatch({ Entries: this.buffer, QueueUrl: this.queueUrl }).promise(); this.buffer = []; } this.emit('msgProcessed', obj); return cb(); } catch (err) { this.emit('msgProcessingErr', obj, err); return cb(err); }
}
async _final(cb) { try { if (this.buffer.length > 0) { console.log("_final() - sending sqs message: " + JSON.stringify(this.buffer)); await this.sqs.sendMessageBatch({ Entries: this.buffer, QueueUrl: this.queueUrl }).promise(); this.buffer = []; }
return cb(); } catch (err) { this.emit('streamFinishingErr', err); return cb(err); }
The text was updated successfully, but these errors were encountered:
fix buffer flush
4281f1c
as proposed by @gavinklfong in danielyaa5#3
No branches or pull requests
2 issues:
Please find amended version of _write() and _final() below
async _write(obj, enc, cb) {
this.emit('msgReceived', obj);
try {
if (!this.queueUrl) {
await this.getQueueUrl();
}
}
async _final(cb) {
try {
if (this.buffer.length > 0) {
console.log("_final() - sending sqs message: " + JSON.stringify(this.buffer));
await this.sqs.sendMessageBatch({ Entries: this.buffer, QueueUrl: this.queueUrl }).promise();
this.buffer = [];
}
}
The text was updated successfully, but these errors were encountered: