Skip to content

Commit

Permalink
Pass interceptor to super constructor (#876)
Browse files Browse the repository at this point in the history
Signed-off-by: Sooraj Sinha <soosinha@amazon.com>
  • Loading branch information
soosinha committed Jul 5, 2021
1 parent 2d1a1e6 commit a428e6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
protected final ThreadPool threadPool;
protected final ScriptService scriptService;
protected final ReindexSslConfig sslConfig;
protected Optional<HttpRequestInterceptor> interceptor;
protected final Optional<HttpRequestInterceptor> interceptor;

/**
* The request for this action. Named mainRequest because we create lots of <code>request</code> variables all representing child
Expand All @@ -138,10 +138,19 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
private final BiFunction<RequestWrapper<?>, ScrollableHitSource.Hit, RequestWrapper<?>> scriptApplier;
private int lastBatchSize;

AbstractAsyncBulkByScrollAction(BulkByScrollTask task, boolean needsSourceDocumentVersions,
boolean needsSourceDocumentSeqNoAndPrimaryTerm, Logger logger, ParentTaskAssigningClient client,
ThreadPool threadPool, Request mainRequest, ActionListener<BulkByScrollResponse> listener,
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig) {
this(task, needsSourceDocumentVersions, needsSourceDocumentSeqNoAndPrimaryTerm, logger, client,
threadPool, mainRequest, listener, scriptService, sslConfig, Optional.empty());
}

AbstractAsyncBulkByScrollAction(BulkByScrollTask task, boolean needsSourceDocumentVersions,
boolean needsSourceDocumentSeqNoAndPrimaryTerm, Logger logger, ParentTaskAssigningClient client,
ThreadPool threadPool, Request mainRequest, ActionListener<BulkByScrollResponse> listener,
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig) {
@Nullable ScriptService scriptService, @Nullable ReindexSslConfig sslConfig,
Optional<HttpRequestInterceptor> interceptor) {
this.task = task;
this.scriptService = scriptService;
this.sslConfig = sslConfig;
Expand All @@ -155,7 +164,7 @@ public abstract class AbstractAsyncBulkByScrollAction<Request extends AbstractBu
this.threadPool = threadPool;
this.mainRequest = mainRequest;
this.listener = listener;
this.interceptor = Optional.empty();
this.interceptor = interceptor;
BackoffPolicy backoffPolicy = buildBackoffPolicy();
bulkRetry = new Retry(BackoffPolicy.wrap(backoffPolicy, worker::countBulkRetry), threadPool);
scrollSource = buildScrollableResultSource(backoffPolicy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ static class AsyncIndexBySearchAction extends AbstractAsyncBulkByScrollAction<Re
* external versioning.
*/
request.getDestination().versionType() != VersionType.INTERNAL,
false, logger, client, threadPool, request, listener, scriptService, sslConfig);
this.interceptor = interceptor;
false, logger, client, threadPool, request, listener, scriptService, sslConfig, interceptor);
}

@Override
Expand Down

0 comments on commit a428e6f

Please sign in to comment.