Commit b08040b
refactor: simplify client ownership by initializing flag in base class
- Initialize _client_provided_by_user = False in BaseContextManagerStore.__init__()
- Remove redundant = False assignments from all store implementations
- Add ownership checks in _close() methods to prevent closing user-provided clients
- Add ownership checks in __del__() methods where applicable (RocksDB, Disk)
- Fixes test failures where stores were closing user-provided clients
This simplifies the ownership pattern: stores only set the flag to True
when users provide a client, relying on the base class default of False
for internally-created clients.
Co-authored-by: William Easton <[email protected]>1 parent c6c6bea commit b08040b
File tree
18 files changed
+45
-42
lines changed- key-value
- key-value-aio/src/key_value/aio/stores
- disk
- duckdb
- dynamodb
- elasticsearch
- memcached
- mongodb
- redis
- rocksdb
- valkey
- key-value-sync/src/key_value/sync/code_gen/stores
- disk
- duckdb
- elasticsearch
- mongodb
- redis
- rocksdb
- valkey
18 files changed
+45
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
437 | 442 | | |
438 | 443 | | |
439 | 444 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
125 | 124 | | |
126 | 125 | | |
127 | 126 | | |
128 | | - | |
| 127 | + | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | | - | |
158 | 157 | | |
159 | 158 | | |
160 | 159 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
263 | 262 | | |
264 | 263 | | |
265 | 264 | | |
266 | | - | |
| 265 | + | |
267 | 266 | | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
| |||
553 | 552 | | |
554 | 553 | | |
555 | 554 | | |
556 | | - | |
| 555 | + | |
| 556 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | 76 | | |
78 | 77 | | |
79 | 78 | | |
| |||
153 | 152 | | |
154 | 153 | | |
155 | 154 | | |
156 | | - | |
| 155 | + | |
| 156 | + | |
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
181 | | - | |
182 | 180 | | |
183 | 181 | | |
184 | 182 | | |
| |||
345 | 343 | | |
346 | 344 | | |
347 | 345 | | |
348 | | - | |
| 346 | + | |
| 347 | + | |
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
85 | 84 | | |
86 | 85 | | |
87 | 86 | | |
88 | | - | |
89 | 87 | | |
90 | 88 | | |
91 | 89 | | |
| |||
222 | 220 | | |
223 | 221 | | |
224 | 222 | | |
225 | | - | |
| 223 | + | |
| 224 | + | |
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
| 86 | + | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
| 194 | + | |
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | 77 | | |
79 | 78 | | |
80 | 79 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
169 | | - | |
170 | | - | |
| 167 | + | |
| 168 | + | |
0 commit comments