Skip to content

Commit e86157a

Browse files
committed
chore: review
1 parent c4c8800 commit e86157a

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

scripts/cts/testServer/replaceAllObjectsWithTransformation.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import express from 'express';
66

77
import { setupServer } from './index.ts';
88

9-
const raoState: Record<
9+
const raowtState: Record<
1010
string,
1111
{
1212
copyCount: number;
@@ -19,9 +19,9 @@ const raoState: Record<
1919
> = {};
2020

2121
export function assertValidReplaceAllObjectsWithTransformation(expectedCount: number): void {
22-
expect(Object.keys(raoState)).to.have.length(expectedCount);
23-
for (const lang in raoState) {
24-
expect(raoState[lang].successful).to.equal(true);
22+
expect(Object.keys(raowtState)).to.have.length(expectedCount);
23+
for (const lang in raowtState) {
24+
expect(raowtState[lang].successful).to.equal(true);
2525
}
2626
}
2727

@@ -43,8 +43,8 @@ function addRoutes(app: Express): void {
4343
expect(req.body.scope).to.deep.equal(['settings', 'rules', 'synonyms']);
4444

4545
const lang = req.params.indexName.replace('cts_e2e_replace_all_objects_with_transformation_', '');
46-
if (!raoState[lang] || raoState[lang].successful) {
47-
raoState[lang] = {
46+
if (!raowtState[lang] || raowtState[lang].successful) {
47+
raowtState[lang] = {
4848
copyCount: 1,
4949
pushCount: 0,
5050
waitTaskCount: 0,
@@ -53,16 +53,16 @@ function addRoutes(app: Express): void {
5353
successful: false,
5454
};
5555
} else {
56-
raoState[lang].copyCount++;
56+
raowtState[lang].copyCount++;
5757
}
5858

59-
res.json({ taskID: 123 + raoState[lang].copyCount, updatedAt: '2021-01-01T00:00:00.000Z' });
59+
res.json({ taskID: 123 + raowtState[lang].copyCount, updatedAt: '2021-01-01T00:00:00.000Z' });
6060
break;
6161
}
6262
case 'move': {
6363
const lang = req.body.destination.replace('cts_e2e_replace_all_objects_with_transformation_', '');
64-
expect(raoState).to.include.keys(lang);
65-
expect(raoState[lang]).to.deep.equal({
64+
expect(raowtState).to.include.keys(lang);
65+
expect(raowtState[lang]).to.deep.equal({
6666
copyCount: 2,
6767
pushCount: 10,
6868
waitTaskCount: 2,
@@ -73,7 +73,7 @@ function addRoutes(app: Express): void {
7373

7474
expect(req.body.scope).to.equal(undefined);
7575

76-
raoState[lang].waitingForFinalWaitTask = true;
76+
raowtState[lang].waitingForFinalWaitTask = true;
7777

7878
res.json({ taskID: 777, updatedAt: '2021-01-01T00:00:00.000Z' });
7979

@@ -90,14 +90,14 @@ function addRoutes(app: Express): void {
9090
const lang = req.params.indexName.match(
9191
/^cts_e2e_replace_all_objects_with_transformation_(.*)_tmp_\d+$/,
9292
)?.[1] as string;
93-
expect(raoState).to.include.keys(lang);
93+
expect(raowtState).to.include.keys(lang);
9494
expect(req.body.action === 'addObject').to.equal(true);
9595

96-
raoState[lang].pushCount += req.body.records.length;
96+
raowtState[lang].pushCount += req.body.records.length;
9797

9898
res.json({
9999
runID: 'b1b7a982-524c-40d2-bb7f-48aab075abda',
100-
eventID: `113b2068-6337-4c85-b5c2-e7b213d8292${raoState[lang].pushCount}`,
100+
eventID: `113b2068-6337-4c85-b5c2-e7b213d8292${raowtState[lang].pushCount}`,
101101
message: 'OK',
102102
createdAt: '2022-05-12T06:24:30.049Z',
103103
});
@@ -111,14 +111,14 @@ function addRoutes(app: Express): void {
111111
const lang = req.params.indexName.match(
112112
/^cts_e2e_replace_all_objects_with_transformation_(.*)_tmp_\d+$/,
113113
)?.[1] as string;
114-
expect(raoState).to.include.keys(lang);
114+
expect(raowtState).to.include.keys(lang);
115115

116-
raoState[lang].waitTaskCount++;
117-
if (raoState[lang].waitingForFinalWaitTask) {
116+
raowtState[lang].waitTaskCount++;
117+
if (raowtState[lang].waitingForFinalWaitTask) {
118118
expect(req.params.taskID).to.equal('777');
119-
expect(raoState[lang].waitTaskCount).to.equal(3);
119+
expect(raowtState[lang].waitTaskCount).to.equal(3);
120120

121-
raoState[lang].successful = true;
121+
raowtState[lang].successful = true;
122122
}
123123

124124
res.json({ status: 'published', updatedAt: '2021-01-01T00:00:00.000Z' });

templates/javascript/clients/algoliasearch/builds/definition.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export type Algoliasearch = SearchClient & {
8686
* @param chunkedPush.action - The `batch` `action` to perform on the given array of `objects`, defaults to `addObject`.
8787
* @param chunkedPush.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
8888
* @param chunkedPush.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
89-
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getTask` method and merged with the transporter requestOptions.
89+
* @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
9090
*/
9191
chunkedPush: (options: ChunkedBatchOptions, requestOptions?: RequestOptions) => Promise<Array<WatchResponse>>;
9292
};
@@ -207,7 +207,7 @@ export function algoliasearch(
207207

208208
if (waitForTasks) {
209209
for (const resp of responses) {
210-
if (resp.eventID === undefined || !resp.eventID) {
210+
if (!resp.eventID) {
211211
throw new Error('received unexpected response from the push endpoint, eventID must not be undefined');
212212
}
213213

@@ -231,7 +231,7 @@ export function algoliasearch(
231231
validate: () => retryCount >= 50,
232232
message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`,
233233
},
234-
timeout: (): number => Math.min(retryCount * 200, 5000),
234+
timeout: (): number => Math.min(retryCount * 500, 5000),
235235
});
236236
}
237237
}

0 commit comments

Comments
 (0)