Skip to content

Commit

Permalink
Once the buffer has any events, the collector is always ready (#36995) (
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline authored May 24, 2019
1 parent d710b06 commit e874a8e
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { opsBuffer } from './ops_buffer';
import Oppsy from 'oppsy';
import { cloneDeep } from 'lodash';

let bufferHadEvents = false;

class OpsMonitor {
constructor(server, buffer, interval) {
Expand Down Expand Up @@ -80,7 +81,12 @@ export function getOpsStatsCollector(server, kbnServer) {
return collectorSet.makeStatsCollector({
type: KIBANA_STATS_TYPE_MONITORING,
init: opsMonitor.start,
isReady: () => buffer.hasEvents(),
isReady: () => {
if (!bufferHadEvents) {
bufferHadEvents = buffer.hasEvents();
}
return bufferHadEvents;
},
fetch: async () => {
return await buffer.flush();
}
Expand Down

0 comments on commit e874a8e

Please sign in to comment.