mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
logs: batch log messages by default (1000ms)
This commit is contained in:
parent
38f71c6d8d
commit
238e66474a
1 changed files with 5 additions and 2 deletions
|
@ -189,7 +189,10 @@ export class LogsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
|
|
||||||
const message = await this.getLogMessage(type, data);
|
const message = await this.getLogMessage(type, data);
|
||||||
if (message) {
|
if (message) {
|
||||||
if (opts.batched) {
|
const batched = opts.batched ?? true; // Default to batched unless explicitly disabled
|
||||||
|
const batchTime = opts.batch_time ?? 1000;
|
||||||
|
|
||||||
|
if (batched) {
|
||||||
// If we're batching log messages, gather all log messages within the set batch_time into a single message
|
// If we're batching log messages, gather all log messages within the set batch_time into a single message
|
||||||
if (!this.batches.has(channel.id)) {
|
if (!this.batches.has(channel.id)) {
|
||||||
this.batches.set(channel.id, []);
|
this.batches.set(channel.id, []);
|
||||||
|
@ -197,7 +200,7 @@ export class LogsPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
const batchedMessage = this.batches.get(channel.id).join("\n");
|
const batchedMessage = this.batches.get(channel.id).join("\n");
|
||||||
this.batches.delete(channel.id);
|
this.batches.delete(channel.id);
|
||||||
createChunkedMessage(channel, batchedMessage).catch(noop);
|
createChunkedMessage(channel, batchedMessage).catch(noop);
|
||||||
}, opts.batch_time || 2000);
|
}, batchTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.batches.get(channel.id).push(message);
|
this.batches.get(channel.id).push(message);
|
||||||
|
|
Loading…
Add table
Reference in a new issue