Skip to content

Commit d650fd2

Browse files
Fix wording, remove check on instance type as already done on pre-init.
1 parent 46f9fdc commit d650fd2

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

packages/cli/src/modules/insights/__tests__/insights.service.test.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,16 +125,6 @@ describe('startTimers', () => {
125125
expect(compactionService.startCompactionTimer).not.toHaveBeenCalled();
126126
expect(pruningService.startPruningTimer).not.toHaveBeenCalled();
127127
});
128-
129-
test('do not start any timers for worker instance', () => {
130-
setupMocks('worker', false, false);
131-
132-
insightsService.startTimers();
133-
134-
expect(collectionService.startFlushingTimer).not.toHaveBeenCalled();
135-
expect(compactionService.startCompactionTimer).not.toHaveBeenCalled();
136-
expect(pruningService.startPruningTimer).not.toHaveBeenCalled();
137-
});
138128
});
139129

140130
describe('getInsightsSummary', () => {

packages/cli/src/modules/insights/insights.service.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,44 +41,37 @@ export class InsightsService {
4141
}
4242

4343
startTimers() {
44-
if (
45-
this.instanceSettings.instanceType !== 'main' &&
46-
this.instanceSettings.instanceType !== 'webhook'
47-
) {
48-
return;
49-
}
50-
5144
this.collectionService.startFlushingTimer();
52-
this.logger.debug('Started collection flushing scheduler');
45+
this.logger.debug('Started flushing timer');
5346

5447
// Start compaction and pruning timers for main leader instance only
5548
if (this.instanceSettings.isLeader) {
56-
this.startCompactionAndPruningSchedulers();
49+
this.startCompactionAndPruningTimers();
5750
}
5851
}
5952

6053
@OnLeaderTakeover()
61-
startCompactionAndPruningSchedulers() {
54+
startCompactionAndPruningTimers() {
6255
this.compactionService.startCompactionTimer();
63-
this.logger.debug('Started compaction scheduler');
56+
this.logger.debug('Started compaction timer');
6457
if (this.pruningService.isPruningEnabled) {
6558
this.pruningService.startPruningTimer();
66-
this.logger.debug('Started pruning scheduler');
59+
this.logger.debug('Started pruning timer');
6760
}
6861
}
6962

7063
@OnLeaderStepdown()
71-
stopTimers() {
64+
stopCompactionAndPruningTimers() {
7265
this.compactionService.stopCompactionTimer();
73-
this.logger.debug('Stopped compaction scheduler');
66+
this.logger.debug('Stopped compaction timer');
7467
this.pruningService.stopPruningTimer();
75-
this.logger.debug('Stopped pruning scheduler');
68+
this.logger.debug('Stopped pruning timer');
7669
}
7770

7871
@OnShutdown()
7972
async shutdown() {
8073
await this.collectionService.shutdown();
81-
this.stopTimers();
74+
this.stopCompactionAndPruningTimers();
8275
}
8376

8477
async getInsightsSummary({

0 commit comments

Comments
 (0)