Skip to content

Commit

Permalink
test with refresh=false in report store
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed May 12, 2023
1 parent c2d9382 commit cb41969
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
14 changes: 5 additions & 9 deletions x-pack/plugins/reporting/server/lib/store/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { MIGRATION_VERSION } from './report';

type UpdateResponse<T> = estypes.UpdateResponse<T>;
type IndexResponse = estypes.IndexResponse;
const refresh: estypes.Refresh = 'wait_for';

/*
* When an instance of Kibana claims a report job, this information tells us about that instance
Expand Down Expand Up @@ -154,14 +153,11 @@ export class ReportingStore {
}
}

/*
* Called from addReport, which handles any errors
*/
private async indexReport(report: Report): Promise<IndexResponse> {
const doc = {
index: report._index!,
id: report._id,
refresh,
refresh: false,
body: {
...report.toReportSource(),
...sourceDoc({
Expand Down Expand Up @@ -293,7 +289,7 @@ export class ReportingStore {
index: report._index,
if_seq_no: report._seq_no,
if_primary_term: report._primary_term,
refresh,
refresh: false,
body: { doc },
});
} catch (err) {
Expand Down Expand Up @@ -332,7 +328,7 @@ export class ReportingStore {
index: report._index,
if_seq_no: report._seq_no,
if_primary_term: report._primary_term,
refresh,
refresh: false,
body: { doc },
});
} catch (err) {
Expand Down Expand Up @@ -367,7 +363,7 @@ export class ReportingStore {
index: report._index,
if_seq_no: report._seq_no,
if_primary_term: report._primary_term,
refresh,
refresh: false,
body: { doc },
});
} catch (err) {
Expand All @@ -394,7 +390,7 @@ export class ReportingStore {
index: report._index,
if_seq_no: report._seq_no,
if_primary_term: report._primary_term,
refresh,
refresh: false,
body: { doc },
});
} catch (err) {
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/reporting/server/routes/lib/jobs_query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ export function jobsQueryFactory(reportingCore: ReportingCore): JobsQueryFactory
try {
const { asInternalUser: elasticsearchClient } = await reportingCore.getEsClient();

// TODO: Use refresh=false.
// Using `wait_for` helps avoid users seeing recently-deleted reports temporarily flashing back in the
// job listing.
const query = { id, index: deleteIndex, refresh: 'wait_for' as const };
Expand Down

0 comments on commit cb41969

Please sign in to comment.