Copilot commented on code in PR #4616:
URL: https://github.com/apache/polaris/pull/4616#discussion_r3357088660


##########
runtime/service/src/main/java/org/apache/polaris/service/config/ServiceProducers.java:
##########
@@ -459,4 +461,27 @@ public PolarisMetricsReporter metricsReporter(
       MetricsReportingConfiguration config, @Any 
Instance<PolarisMetricsReporter> reporters) {
     return reporters.select(Identifier.Literal.of(config.type())).get();
   }
+
+  @Produces
+  @Singleton
+  @Identifier("event-listener-executor")
+  public Executor eventListenerExecutor(PolarisEventListenerConfiguration 
config) {
+    if (config.types().isEmpty()) {
+      return r -> {};
+    }

Review Comment:
   The fallback executor returned when no event listeners are configured 
currently drops submitted tasks (`r -> {}`), which violates the `Executor` 
contract and could silently hide bugs if this executor is accidentally used 
(e.g., a future code path executes it even when no listeners are configured). 
Returning a direct executor preserves the “no extra threads” intent without 
losing work.



##########
runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventListeners.java:
##########
@@ -69,7 +74,8 @@ public void onStartup(@Observes StartupEvent event) {
       }
       var listener = 
eventListeners.select(Identifier.Literal.of(enabledEventListener)).get();
       Handler<Message<PolarisEvent>> handler =
-          message -> deliverEvent(message.body(), enabledEventListener, 
listener);
+          message ->
+              executor.execute(() -> deliverEvent(message.body(), 
enabledEventListener, listener));

Review Comment:
   `executor.execute(...)` can throw (e.g., `RejectedExecutionException` when 
the executor queue is bounded and full). If this escapes the Vert.x event bus 
handler, it can fail message handling and/or spam logs without a clear 
indication that the event was dropped. Consider catching runtime failures from 
scheduling and logging them (optionally with a fallback delivery policy).



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

Reply via email to