Skip to content

Commit

Permalink
feedback changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Aug 13, 2020
1 parent dcacb6d commit 7a9175c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions x-pack/plugins/reporting/server/lib/enqueue_job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,15 @@ export function enqueueJobFactory(
throw new Error(`Export type ${exportTypeId} does not exist in the registry!`);
}

// encrypt the headers in the payload
const scheduleTask = exportType.scheduleTaskFnFactory(reporting, logger) as ScheduleTaskFnType;
const [scheduleTask, { store }] = await Promise.all([
exportType.scheduleTaskFnFactory(reporting, logger) as ScheduleTaskFnType,
reporting.getPluginStartDeps(),
]);

// add encrytped headers
const payload = await scheduleTask(jobParams, context, request);

// store the pending report, puts it in the Reporting Management UI table
const { store } = await reporting.getPluginStartDeps();
const report = await store.addReport(exportType.jobType, username, payload);

logger.info(`Scheduled ${exportType.name} report: ${report._id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/

import { statuses } from '../../statuses';
import { events } from './events';
import { defaultSettings } from './default_settings';
import { events } from './events';

export const constants = {
...events,
Expand Down

0 comments on commit 7a9175c

Please sign in to comment.