diff --git a/.buildkite/Dockerfile b/.buildkite/Dockerfile index 2bf3886dc..0de3234dc 100644 --- a/.buildkite/Dockerfile +++ b/.buildkite/Dockerfile @@ -12,5 +12,3 @@ WORKDIR /usr/src/app COPY package.json . RUN npm install - -COPY . . diff --git a/.buildkite/Dockerfile-make b/.buildkite/Dockerfile-make index 3805eb0a2..b171f5d03 100644 --- a/.buildkite/Dockerfile-make +++ b/.buildkite/Dockerfile-make @@ -25,6 +25,3 @@ USER ${BUILDER_UID}:${BUILDER_GID} # install dependencies COPY package.json . RUN npm install - -# copy project files -COPY . . diff --git a/src/helpers.ts b/src/helpers.ts index 89f804b89..46d82e28f 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -41,7 +41,7 @@ export interface MsearchHelperOptions extends T.MsearchRequest { export interface MsearchHelper extends Promise { stop: (error?: Error | null) => void - search: (header: T.MsearchMultisearchHeader, body: T.MsearchMultisearchBody) => Promise> + search: (header: T.MsearchMultisearchHeader, body: T.SearchSearchRequestBody) => Promise> } export interface MsearchHelperResponse { @@ -362,7 +362,7 @@ export default class Helpers { // TODO: support abort a single search? // NOTE: the validation checks are synchronous and the callback/promise will // be resolved in the same tick. We might want to fix this in the future. - search (header: T.MsearchMultisearchHeader, body: T.MsearchMultisearchBody): Promise> { + search (header: T.MsearchMultisearchHeader, body: T.SearchSearchRequestBody): Promise> { if (stopReading) { const error = stopError === null ? new ConfigurationError('The msearch processor has been stopped') @@ -397,7 +397,7 @@ export default class Helpers { async function iterate (): Promise { const { semaphore, finish } = buildSemaphore() - const msearchBody: Array = [] + const msearchBody: Array = [] const callbacks: any[] = [] let loadedOperations = 0 timeoutRef = setTimeout(onFlushTimeout, flushInterval) // eslint-disable-line @@ -490,7 +490,7 @@ export default class Helpers { } } - function send (msearchBody: Array, callbacks: any[]): void { + function send (msearchBody: Array, callbacks: any[]): void { /* istanbul ignore if */ if (running > concurrency) { throw new Error('Max concurrency reached') @@ -508,7 +508,7 @@ export default class Helpers { } } - function msearchOperation (msearchBody: Array, callbacks: any[], done: () => void): void { + function msearchOperation (msearchBody: Array, callbacks: any[], done: () => void): void { let retryCount = retries // Instead of going full on async-await, which would make the code easier to read, @@ -516,7 +516,7 @@ export default class Helpers { // This because every time we use async await, V8 will create multiple promises // behind the scenes, making the code slightly slower. tryMsearch(msearchBody, callbacks, retrySearch) - function retrySearch (msearchBody: Array, callbacks: any[]): void { + function retrySearch (msearchBody: Array, callbacks: any[]): void { if (msearchBody.length > 0 && retryCount > 0) { retryCount -= 1 setTimeout(tryMsearch, wait, msearchBody, callbacks, retrySearch) @@ -528,7 +528,7 @@ export default class Helpers { // This function never returns an error, if the msearch operation fails, // the error is dispatched to all search executors. - function tryMsearch (msearchBody: Array, callbacks: any[], done: (msearchBody: Array, callbacks: any[]) => void): void { + function tryMsearch (msearchBody: Array, callbacks: any[], done: (msearchBody: Array, callbacks: any[]) => void): void { client.msearch(Object.assign({}, msearchOptions, { body: msearchBody }), reqOptions as TransportRequestOptionsWithMeta) .then(results => { const retryBody = []