Просмотр исходного кода

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 1 день назад
Родитель
Сommit
c1d441feed
1 измененных файлов с 1 добавлено и 0 удалено
  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)) {