Commit bef9ef1
[Python] Reuse Milvus client in RAG vector sink write path (#39378)
* Reuse Milvus client in vector sink write path
_MilvusSink.write() constructed a new MilvusClient on every call, which
discarded the retry-wrapped client created in __enter__. This bypassed the
connection retry/backoff and left the initial client unclosed (leaked),
while __exit__ only closed the last client. The write() docstring also
incorrectly claimed the collection was flushed for durability.
Reuse the client established in __enter__ for the upsert, and correct the
docstring to describe the actual (no-flush) visibility semantics. Add a
unit test asserting write() reuses the __enter__ client instead of
reconstructing one per call.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Clear Milvus client after close in sink __exit__
Set self._client to None after closing so a reused sink instance does
not keep a stale closed client. Address review feedback.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 0643150 commit bef9ef1
2 files changed
Lines changed: 43 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
290 | | - | |
291 | | - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
292 | 297 | | |
293 | 298 | | |
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | 302 | | |
301 | 303 | | |
302 | 304 | | |
| |||
346 | 348 | | |
347 | 349 | | |
348 | 350 | | |
| 351 | + | |
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
122 | 157 | | |
123 | 158 | | |
0 commit comments