Skip to content

Commit f71419d

Browse files
authored
Add retries to configureIndex and update operations (#318)
## Problem We first shipped retries to `upsert` as a POC. Now that we are happy with that, we are expanding retries to `configureIndex` and `update` operations. This PR includes updates to the retry logic itself, too: I found some errors when I applied it to `configureIndex`, yay! ## Type of Change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [x] This change requires a documentation update - [ ] Infrastructure change (CI configs, etc) - [ ] Non-code change (docs, etc) - [ ] None of the above: (explain here) ## Test Plan CI passes. --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1208718597634858
1 parent 4516c53 commit f71419d

File tree

11 files changed

+335
-229
lines changed

11 files changed

+335
-229
lines changed

.github/workflows/testing.yml

Lines changed: 184 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -26,190 +26,190 @@ jobs:
2626
SERVERLESS_INDEX_NAME=$(npx ts-node ./src/integration/setup.ts | grep "SERVERLESS_INDEX_NAME=" | cut -d'=' -f2)
2727
echo "SERVERLESS_INDEX_NAME=$SERVERLESS_INDEX_NAME" >> $GITHUB_OUTPUT
2828
29-
unit-tests:
30-
needs: setup
31-
name: Run unit tests
32-
runs-on: ubuntu-latest
33-
steps:
34-
- name: Checkout
35-
uses: actions/checkout@v4
36-
37-
- name: Setup
38-
uses: ./.github/actions/setup
39-
40-
- name: Run tests
41-
env:
42-
CI: true
43-
run: npm run test:unit -- --coverage
44-
45-
integration-tests:
46-
needs: setup
47-
name: Run integration tests
48-
runs-on: ubuntu-latest
49-
outputs:
50-
serverlessIndexName: ${{ steps.runTests1.outputs.SERVERLESS_INDEX_NAME }}
51-
strategy:
52-
fail-fast: false
53-
max-parallel: 2
54-
matrix:
55-
pinecone_env:
56-
- prod
57-
# - staging
58-
node_version: [18.x, 20.x]
59-
config:
60-
[
61-
{ runner: 'npm', jest_env: 'node' },
62-
{ runner: 'npm', jest_env: 'edge' },
63-
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.0' },
64-
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.36' },
65-
{ runner: 'bun', jest_env: 'node', bun_version: '1.1.11' },
66-
]
67-
68-
steps:
69-
- name: Checkout
70-
uses: actions/checkout@v4
71-
72-
- name: Setup
73-
uses: ./.github/actions/setup
74-
with:
75-
node_version: ${{ matrix.node_version }}
76-
77-
- name: Setup bun
78-
if: matrix.config.bun_version
79-
uses: oven-sh/setup-bun@v1
80-
with:
81-
bun-version: ${{ matrix.config.bun_version }}
82-
83-
- name: Run integration tests (Prod)
84-
id: runTests1
85-
if: matrix.pinecone_env == 'prod'
86-
env:
87-
CI: true
88-
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
89-
SERVERLESS_INDEX_NAME: ${{ needs.setup.outputs.serverlessIndexName}}
90-
run: |
91-
${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
92-
echo "SERVERLESS_INDEX_NAME=${{ needs.setup.outputs.serverlessIndexName}}" >> $GITHUB_OUTPUT
93-
94-
- name: Run integration tests (Staging)
95-
if: matrix.pinecone_env == 'staging'
96-
env:
97-
CI: true
98-
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
99-
PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io'
100-
run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
101-
102-
teardown:
103-
name: Teardown
104-
needs: integration-tests # Ensure teardown only runs after test jobs
105-
runs-on: ubuntu-latest
106-
if: always() # Run teardown even if the tests fail
107-
steps:
108-
- name: Checkout code
109-
uses: actions/checkout@v4
110-
111-
- name: Install dependencies
112-
run: npm ci
113-
114-
- name: Run teardown script
115-
env:
116-
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
117-
SERVERLESS_INDEX_NAME: ${{ needs.integration-tests.outputs.serverlessIndexName}}
118-
run: |
119-
npx ts-node ./src/integration/teardown.ts
120-
121-
typescript-compilation-tests:
122-
name: TS compile
123-
runs-on: ubuntu-latest
124-
strategy:
125-
fail-fast: false
126-
matrix:
127-
tsVersion:
128-
[
129-
'~4.1.0',
130-
'~4.2.0',
131-
'~4.3.0',
132-
'~4.4.0',
133-
'~4.5.0',
134-
'~4.6.0',
135-
'~4.7.0',
136-
'~4.8.0',
137-
'~4.9.0',
138-
'~5.0.0',
139-
'~5.1.0',
140-
'~5.2.0',
141-
'latest',
142-
]
143-
steps:
144-
- name: Checkout
145-
uses: actions/checkout@v4
146-
- name: Setup Node
147-
uses: actions/setup-node@v4
148-
with:
149-
node-version: 18.x
150-
registry-url: 'https://registry.npmjs.org'
151-
- name: Install npm packages
152-
run: |
153-
npm install --ignore-scripts
154-
shell: bash
155-
- name: Build TypeScript for Pinecone
156-
run: npm run build
157-
shell: bash
158-
- name: install, compile, and run sample app
159-
shell: bash
160-
env:
161-
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
162-
run: |
163-
set -x
164-
cd ..
165-
cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test
166-
cd ts-compilation-test
167-
npm install typescript@${{ matrix.tsVersion }} --no-cache
168-
npm install '../pinecone-ts-client' --no-cache
169-
cat package.json
170-
cat package-lock.json
171-
npm run tsc-version
172-
npm run build
173-
npm run start
174-
175-
example-app-semantic-search:
176-
name: 'Example app: semantic search'
177-
runs-on: ubuntu-latest
178-
steps:
179-
- name: Checkout pinecone-ts-client
180-
uses: actions/checkout@v4
181-
with:
182-
path: pinecone-ts-client
183-
- name: Checkout semantic-search-example
184-
uses: actions/checkout@v4
185-
with:
186-
repository: pinecone-io/semantic-search-example
187-
ref: spruce
188-
path: semantic-search-example
189-
- name: Install and build client
190-
shell: bash
191-
run: |
192-
cd pinecone-ts-client
193-
npm install --ignore-scripts
194-
npm run build
195-
- name: Install and build sample app
196-
shell: bash
197-
run: |
198-
cd semantic-search-example
199-
npm install --no-cache
200-
npm install '../pinecone-ts-client'
201-
cat package.json
202-
- name: Run example tests with dev version of client
203-
env:
204-
CI: true
205-
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
206-
PINECONE_INDEX: 'semantic-search'
207-
PINECONE_CLOUD: 'aws'
208-
PINECONE_REGION: 'us-west-2'
209-
shell: bash
210-
run: |
211-
cd semantic-search-example
212-
npm run test
29+
unit-tests:
30+
needs: setup
31+
name: Run unit tests
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v4
36+
37+
- name: Setup
38+
uses: ./.github/actions/setup
39+
40+
- name: Run tests
41+
env:
42+
CI: true
43+
run: npm run test:unit -- --coverage
44+
45+
integration-tests:
46+
needs: setup
47+
name: Run integration tests
48+
runs-on: ubuntu-latest
49+
outputs:
50+
serverlessIndexName: ${{ steps.runTests1.outputs.SERVERLESS_INDEX_NAME }}
51+
strategy:
52+
fail-fast: false
53+
max-parallel: 2
54+
matrix:
55+
pinecone_env:
56+
- prod
57+
# - staging
58+
node_version: [18.x, 20.x]
59+
config:
60+
[
61+
{ runner: 'npm', jest_env: 'node' },
62+
{ runner: 'npm', jest_env: 'edge' },
63+
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.0' },
64+
{ runner: 'bun', jest_env: 'node', bun_version: '1.0.36' },
65+
{ runner: 'bun', jest_env: 'node', bun_version: '1.1.11' },
66+
]
67+
68+
steps:
69+
- name: Checkout
70+
uses: actions/checkout@v4
71+
72+
- name: Setup
73+
uses: ./.github/actions/setup
74+
with:
75+
node_version: ${{ matrix.node_version }}
76+
77+
- name: Setup bun
78+
if: matrix.config.bun_version
79+
uses: oven-sh/setup-bun@v1
80+
with:
81+
bun-version: ${{ matrix.config.bun_version }}
82+
83+
- name: Run integration tests (Prod)
84+
id: runTests1
85+
if: matrix.pinecone_env == 'prod'
86+
env:
87+
CI: true
88+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
89+
SERVERLESS_INDEX_NAME: ${{ needs.setup.outputs.serverlessIndexName}}
90+
run: |
91+
${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
92+
echo "SERVERLESS_INDEX_NAME=${{ needs.setup.outputs.serverlessIndexName}}" >> $GITHUB_OUTPUT
93+
94+
- name: Run integration tests (Staging)
95+
if: matrix.pinecone_env == 'staging'
96+
env:
97+
CI: true
98+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
99+
PINECONE_CONTROLLER_HOST: 'https://api-staging.pinecone.io'
100+
run: ${{ matrix.config.runner }} run test:integration:${{ matrix.config.jest_env }}
101+
102+
teardown:
103+
name: Teardown
104+
needs: integration-tests # Ensure teardown only runs after test jobs
105+
runs-on: ubuntu-latest
106+
if: always() # Run teardown even if the tests fail
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Install dependencies
112+
run: npm ci
113+
114+
- name: Run teardown script
115+
env:
116+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
117+
SERVERLESS_INDEX_NAME: ${{ needs.integration-tests.outputs.serverlessIndexName}}
118+
run: |
119+
npx ts-node ./src/integration/teardown.ts
120+
121+
typescript-compilation-tests:
122+
name: TS compile
123+
runs-on: ubuntu-latest
124+
strategy:
125+
fail-fast: false
126+
matrix:
127+
tsVersion:
128+
[
129+
'~4.1.0',
130+
'~4.2.0',
131+
'~4.3.0',
132+
'~4.4.0',
133+
'~4.5.0',
134+
'~4.6.0',
135+
'~4.7.0',
136+
'~4.8.0',
137+
'~4.9.0',
138+
'~5.0.0',
139+
'~5.1.0',
140+
'~5.2.0',
141+
'latest',
142+
]
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v4
146+
- name: Setup Node
147+
uses: actions/setup-node@v4
148+
with:
149+
node-version: 18.x
150+
registry-url: 'https://registry.npmjs.org'
151+
- name: Install npm packages
152+
run: |
153+
npm install --ignore-scripts
154+
shell: bash
155+
- name: Build TypeScript for Pinecone
156+
run: npm run build
157+
shell: bash
158+
- name: install, compile, and run sample app
159+
shell: bash
160+
env:
161+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
162+
run: |
163+
set -x
164+
cd ..
165+
cp -r pinecone-ts-client/ts-compilation-test ts-compilation-test
166+
cd ts-compilation-test
167+
npm install typescript@${{ matrix.tsVersion }} --no-cache
168+
npm install '../pinecone-ts-client' --no-cache
169+
cat package.json
170+
cat package-lock.json
171+
npm run tsc-version
172+
npm run build
173+
npm run start
174+
175+
example-app-semantic-search:
176+
name: 'Example app: semantic search'
177+
runs-on: ubuntu-latest
178+
steps:
179+
- name: Checkout pinecone-ts-client
180+
uses: actions/checkout@v4
181+
with:
182+
path: pinecone-ts-client
183+
- name: Checkout semantic-search-example
184+
uses: actions/checkout@v4
185+
with:
186+
repository: pinecone-io/semantic-search-example
187+
ref: spruce
188+
path: semantic-search-example
189+
- name: Install and build client
190+
shell: bash
191+
run: |
192+
cd pinecone-ts-client
193+
npm install --ignore-scripts
194+
npm run build
195+
- name: Install and build sample app
196+
shell: bash
197+
run: |
198+
cd semantic-search-example
199+
npm install --no-cache
200+
npm install '../pinecone-ts-client'
201+
cat package.json
202+
- name: Run example tests with dev version of client
203+
env:
204+
CI: true
205+
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
206+
PINECONE_INDEX: 'semantic-search'
207+
PINECONE_CLOUD: 'aws'
208+
PINECONE_REGION: 'us-west-2'
209+
shell: bash
210+
run: |
211+
cd semantic-search-example
212+
npm run test
213213
214214
external-app:
215215
name: external-app

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const pc = new Pinecone();
6969

7070
If you prefer to pass configuration in code, the constructor accepts a config object containing the `apiKey` value.
7171
This is the object in which you would pass properties like `maxRetries` (defaults to `3`) for retryable operations
72-
(e.g. `upsert`).
72+
(`upsert`, `update`, and `configureIndex`).
7373

7474
```typescript
7575
import { Pinecone } from '@pinecone-database/pinecone';

0 commit comments

Comments
 (0)