Skip to content

Commit

Permalink
Remove unused load distribution logic in Monitor API
Browse files Browse the repository at this point in the history
  • Loading branch information
simlarsen committed Nov 27, 2024
1 parent 854be1d commit a5d993b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ProbeIngest/API/Monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import ProjectService from "Common/Server/Services/ProjectService";
import MonitorType from "Common/Types/Monitor/MonitorType";
import MonitorTest from "Common/Models/DatabaseModels/MonitorTest";
import MonitorTestService from "Common/Server/Services/MonitorTestService";
import NumberUtil from "Common/Utils/Number";

const router: ExpressRouter = Express.getRouter();

Expand Down Expand Up @@ -339,18 +338,18 @@ router.post(

// we do this to distribute the load among the probes.
// so every request will get a different set of monitors to monitor
const moduloBy: number = 10;
const reminder: number = NumberUtil.getRandomNumber(0, 100) % moduloBy;
// const moduloBy: number = 10;
// const reminder: number = NumberUtil.getRandomNumber(0, 100) % moduloBy;

const monitorProbes: Array<MonitorProbe> =
await MonitorProbeService.findBy({
query: {
...getMonitorFetchQuery((req as OneUptimeRequest).probe!.id!),
version: QueryHelper.modulo(moduloBy, reminder), // distribute the load among the probes
// version: QueryHelper.modulo(moduloBy, reminder), // distribute the load among the probes
},
sort: {
nextPingAt: SortOrder.Ascending,
} as any,
},
skip: 0,
limit: limit,
select: {
Expand Down

0 comments on commit a5d993b

Please sign in to comment.