Session can hit errors if used immediately
rukai opened this issue · 0 comments
rukai commented
When a SessionBuilder (e.g. TcpSessionBuilder) build() method is called, a Session is returned.
However there are still background tasks that need to complete before the session can actually be used.
Two examples I have hit are:
- Delayed enabling of event processing - causing the broadcast::receiver returned by create_event_receiver to miss events
- Delayed population of ClusterMetadataManager - causing failure to send prepared statement
Cannot find node 127.0.0.1:9042 for statement re-preparation!
I think a reasonable solution to this would look like adding a tokio::sync::oneshot that gets sent when the session tasks have finished initializing and then the build()
method can await on it.
This can be worked around locally by adding sleeps, but that is clearly not ideal.