Skip to content

Commit

Permalink
Remove unnecessary check of docs count
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsarm committed May 14, 2021
1 parent c6ad957 commit fc23ed4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 3 additions & 8 deletions webapp/src/ts/services/telemetry.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export class TelemetryService {
// moment when the aggregation starts (the beginning of the current day)
private aggregateStartsAt() {
return moment().startOf('day');
//return moment().startOf('minute');
}

// if there is telemetry data from previous days, aggregation is performed and the data destroyed
Expand All @@ -90,13 +89,9 @@ export class TelemetryService {
const dbDate = moment(this.getFirstAggregatedDate());

if (dbDate.isBefore(startOf)) {
return db.info()
.then(info => {
if (info.doc_count > 0) {
return this.aggregate(db)
.then(() => this.reset(db));
}
});
return this
.aggregate(db)
.then(() => this.reset(db));
}
}

Expand Down
1 change: 0 additions & 1 deletion webapp/tests/karma/ts/services/telemetry.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ describe('TelemetryService', () => {
dbService = { get: () => dbInstance };
consoleErrorSpy = sinon.spy(console, 'error');
pouchDb = {
info: sinon.stub().resolves({doc_count: 10}),
post: sinon.stub().resolves(),
close: sinon.stub(),
destroy: sinon.stub().callsFake(() => {
Expand Down

0 comments on commit fc23ed4

Please sign in to comment.