Commit 4223351
authored
Fix: PineconeGrpcFuture blocks during construction (#478)
## Problem
When using grpc with `async_req=True`, the construction of a
`PineconeGrpcFuture` would call `_sync_state`, which would do a blocking
call to `grpc_future.exception(...)`. This means that the async reqs
were all blocking in practice.
Describe the purpose of this change. What problem is being solved and
why?
## Solution
We can fix it by checking if the future is still running and not doing
any blocking calls when it is.
## Type of Change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
- [ ] Infrastructure change (CI configs, etc)
- [ ] Non-code change (docs, etc)
- [ ] None of the above: (explain here)
## Test Plan
How I tested it:
- Before: Run a long query in a loop and hit ctrl-c. Observe the
traceback containing `PineconeGrpcFuture()`
- After: Run a long query in a loop and hit ctrl-c. Observe the
traceback containing your `.result()` call instead.2 files changed
+8
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | | - | |
36 | | - | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
44 | | - | |
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
309 | 311 | | |
310 | 312 | | |
311 | 313 | | |
| 314 | + | |
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
| |||
467 | 470 | | |
468 | 471 | | |
469 | 472 | | |
| 473 | + | |
470 | 474 | | |
471 | 475 | | |
472 | 476 | | |
| |||
0 commit comments