worryg0d commented on code in PR #1929:
URL: 
https://github.com/apache/cassandra-gocql-driver/pull/1929#discussion_r2904409847


##########
metadata.go:
##########
@@ -475,14 +493,32 @@ func refreshSchemas(session *Session) error {
        } else {
                for _, createdKeyspace := range newKeyspaces {
                        
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: createdKeyspace, 
Change: SchemaChangeTypeCreated})
+                       if session.keyspaceChangeListener != nil && 
session.initialized() {
+                               
session.keyspaceChangeListener.OnKeyspaceCreated(KeyspaceCreatedEvent{Keyspace: 
keyspaceMeta[createdKeyspace]})
+                       }
                }
                for _, droppedKeyspace := range droppedKeyspaces {
                        
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: droppedKeyspace, 
Change: SchemaChangeTypeDropped})
+                       if session.keyspaceChangeListener != nil && 
session.initialized() {
+                               
session.keyspaceChangeListener.OnKeyspaceDropped(KeyspaceDroppedEvent{Keyspace: 
oldKeyspaceMeta[droppedKeyspace]})
+                       }
                }
                for _, updatedKeyspace := range updatedKeyspaces {
                        
session.policy.KeyspaceChanged(KeyspaceUpdateEvent{Keyspace: updatedKeyspace, 
Change: SchemaChangeTypeUpdated})
+                       if session.keyspaceChangeListener != nil && 
session.initialized() {
+                               
session.keyspaceChangeListener.OnKeyspaceUpdated(KeyspaceUpdatedEvent{
+                                       Old: oldKeyspaceMeta[updatedKeyspace],
+                                       New: keyspaceMeta[updatedKeyspace],
+                               })
+                       }
                }
        }
+
+       // If we have full metadata cache mode, we need to notify the event 
listener about the full schema changes
+       if session.cfg.Metadata.CacheMode == Full {

Review Comment:
   Makes sense, also added call to `sessison.initialized()` before calling 
handleFullSchemaChanges



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