Skip to content
New issue

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

prevent double DB calls in job #3745

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/device-registry/bin/jobs/check-active-statuses.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@

logObject("activeIncorrectStatusCount", activeIncorrectStatusCount);
logObject("activeMissingStatusCount", activeMissingStatusCount);
const totalActiveDevices = await DeviceModel("airqo").countDocuments({

Check warning on line 63 in src/device-registry/bin/jobs/check-active-statuses.js

View check run for this annotation

Codecov / codecov/patch

src/device-registry/bin/jobs/check-active-statuses.js#L63

Added line #L63 was not covered by tests
isActive: true,
});

const percentageActiveIncorrectStatus =
(activeIncorrectStatusCount /
(await DeviceModel("airqo").countDocuments({ isActive: true }))) *
100;
(activeIncorrectStatusCount / totalActiveDevices) * 100;

Check warning on line 68 in src/device-registry/bin/jobs/check-active-statuses.js

View check run for this annotation

Codecov / codecov/patch

src/device-registry/bin/jobs/check-active-statuses.js#L68

Added line #L68 was not covered by tests
const percentageActiveMissingStatus =
(activeMissingStatusCount /
(await DeviceModel("airqo").countDocuments({ isActive: true }))) *
100;
(activeMissingStatusCount / totalActiveDevices) * 100;

Check warning on line 70 in src/device-registry/bin/jobs/check-active-statuses.js

View check run for this annotation

Codecov / codecov/patch

src/device-registry/bin/jobs/check-active-statuses.js#L70

Added line #L70 was not covered by tests

logObject(
"percentageActiveIncorrectStatus",
Expand Down
Loading