Skip to content

Commit 641a2bd

Browse files
authored
Merge pull request #120 from meilisearch/add-timeout
Increase default timeout & add a way to set as an option
2 parents 6ceeb51 + d8a744a commit 641a2bd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Specify the base Docker image. You can read more about
22
# the available images at https://crawlee.dev/docs/guides/docker-images
33
# You can also use any other image from Docker Hub.
4-
FROM apify/actor-node-puppeteer-chrome:18 AS builder
4+
FROM apify/actor-node-puppeteer-chrome:20-21.4.0 AS builder
55

66
# Copy just package.json and package-lock.json
77
# to speed up the build using Docker layer cache.
@@ -19,7 +19,7 @@ COPY --chown=myuser . ./
1919
RUN yarn run build
2020

2121
# Create final image
22-
FROM apify/actor-node-puppeteer-chrome:18
22+
FROM apify/actor-node-puppeteer-chrome:20-21.4.0
2323

2424
# Copy only built JS files from builder image
2525
COPY --from=builder --chown=myuser /home/myuser/dist ./dist

src/sender.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class Sender {
1111
index_uid: string
1212
batch_size: number
1313
client: MeiliSearch
14+
timeout: number
1415
nb_documents_sent = 0
1516

1617
constructor(config: Config) {
@@ -19,6 +20,7 @@ export class Sender {
1920
this.initial_index_uid = config.meilisearch_index_uid
2021
this.index_uid = this.initial_index_uid
2122
this.batch_size = config.batch_size || 1000
23+
this.timeout = config.timeout || 100000
2224

2325
//Create a Meilisearch client
2426
this.client = initMeilisearchClient({
@@ -116,7 +118,7 @@ export class Sender {
116118
const task = await this.client
117119
.index(this.index_uid)
118120
.addDocuments(this.queue)
119-
await this.client.waitForTask(task.taskUid, { timeOutMs: 15000 })
121+
await this.client.waitForTask(task.taskUid, { timeOutMs: this.timeout })
120122
}
121123

122124
async __swapIndex() {

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type Config = {
2222
user_agents?: string[]
2323
webhook_payload?: Record<string, any>
2424
webhook_url?: string
25+
timeout?: number
2526
}
2627

2728
export type SchemaSettings = {

0 commit comments

Comments
 (0)