Conversation
|
Claude finished @caspervonb's task in 4m 13s —— View job PR Review: Add nats-key-value package
Good overall structure — the package layout, dataclasses, and test coverage modelled on Go's Bugs / correctness:
Resource management:
|
| if entry.operation in (KeyValueOp.DELETE, KeyValueOp.PURGE): | ||
| delete_markers.append(entry) | ||
|
|
||
| await watcher.stop() |
There was a problem hiding this comment.
watcher.stop() is not called if an exception is raised during the async for loop (e.g. from _js._api.stream_purge). The consumer subscription leaks. Same pattern applies in keys() (line ~665) and history() (line ~692). Use try/finally:
watcher = await self.watch_all()
try:
async for entry in watcher:
...
finally:
await watcher.stop()Signed-off-by: Casper Beyer <[email protected]>
Signed-off-by: Casper Beyer <[email protected]>
Signed-off-by: Casper Beyer <[email protected]>
Signed-off-by: Casper Beyer <[email protected]>
Signed-off-by: Casper Beyer <[email protected]>
| @@ -0,0 +1,846 @@ | |||
| """NATS Key-Value Store package.""" | |||
There was a problem hiding this comment.
Prefer nats.key_value
No description provided.