Browse Source

fix: shut down feedback executors before awaiting termination

PsiphonTunnelFeedback.shutdownAndAwaitTermination() was calling awaitTermination() before the executor had entered shutdown state.

That caused the first await to burn the full timeout and then escalate to shutdownNow(), adding an unnecessary 5 second stall per executor in the feedback shutdown path.

Call ExecutorService.shutdown() before awaiting termination so the helper performs the intended orderly shutdown before forcing cancellation.
efryntov 20 hours ago
parent
commit
c1d441feed
1 changed files with 1 additions and 0 deletions
  1. 1 0
      MobileLibrary/Android/PsiphonTunnel/PsiphonTunnel.java

+ 1 - 0
MobileLibrary/Android/PsiphonTunnel/PsiphonTunnel.java

@@ -319,6 +319,7 @@ public class PsiphonTunnel {
         private final ExecutorService callbackQueue = Executors.newSingleThreadExecutor();
 
         void shutdownAndAwaitTermination(ExecutorService pool) {
+            pool.shutdown();
             try {
                 // Wait a while for existing tasks to terminate
                 if (!pool.awaitTermination(5, TimeUnit.SECONDS)) {