skoppu22 commented on code in PR #340:
URL: https://github.com/apache/cassandra-sidecar/pull/340#discussion_r3173397004


##########
server/src/main/java/org/apache/cassandra/sidecar/modules/ConfigurationModule.java:
##########
@@ -126,6 +133,25 @@ CQLSessionProvider cqlSessionProvider(Vertx vertx,
         return cqlSessionProvider;
     }
 
+    @Provides
+    @Singleton
+    DriverUnsupportedSchemaCache driverUnsupportedSchemaCache(Vertx vertx,
+                                                              
SidecarConfiguration sidecarConfiguration,
+                                                              
CQLSessionProvider cqlSessionProvider)
+    {
+        DriverUnsupportedSchemaCache schemaCache = new 
DriverUnsupportedSchemaCache(sidecarConfiguration, cqlSessionProvider);
+        // trigger immediate cache population once Sidecar connects to 
Cassandra node
+        EventBusUtils.onceLocalConsumer(vertx.eventBus(), 
ON_CASSANDRA_CQL_READY.address(), ignored -> schemaCache.refresh(true));

Review Comment:
   Thanks for adding onceLocalConsumer. I believe the handler body still 
executes on the event loop. schemaCache.refresh(true) is synchronized and runs 
blocking CQL.
   
   Every other ON_CASSANDRA_CQL_READY consumer in the codebase uses the pattern 
onceLocalConsumer(…, ignored -> executor.schedule(this)). Could we either 
register DriverUnsupportedSchemaCache as a PeriodicTask via 
executor.schedule(...), or wrap with vertx.executeBlocking(() -> 
schemaCache.refresh(true))?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to