fresh-borzoni commented on PR #438:
URL: https://github.com/apache/fluss-rust/pull/438#issuecomment-4039011485
@qzyu999 Ty, took a look at the approach, have some idead. PTAL
The scanner is already thread-safe internally (&self on all methods), so the
Mutex isn't needed, it just adds locking to every call and forces 5 unsafe
pointer casts to work around borrow issues it created. The __anext__ loop is
also problematic: it runs inside tokio::spawn, so breaking out of async for
leaves it polling forever in the background.
Simpler idea: store the scanner in an Arc, keep existing methods as-is. Add
_async_poll(timeout_ms) that does one bounded poll and returns a list.
__aiter__ returns a small Python async generator that calls _async_poll and
yields records. Break stops the generator naturally, so no leaks, no unsafe, no
mutex.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]