Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Jun 10, 2021
1 parent 972cc82 commit cd0c62f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x-pack/plugins/ml/server/saved_objects/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export function syncSavedObjectsFactory(

const status = await checkStatus();

const adJobsById: Record<string, JobStatus> = {};
status.jobs['anomaly-detector'].map((j) => {
adJobsById[j.jobId] = j;
});
const adJobsById = status.jobs['anomaly-detector'].reduce((acc, j) => {
acc[j.jobId] = j;
return acc;
}, {} as Record<string, JobStatus>);

for (const job of status.jobs['anomaly-detector']) {
if (job.checks.savedObjectExits === false) {
Expand Down

0 comments on commit cd0c62f

Please sign in to comment.