@capgo/capacitor-updater 8.51.10 → 8.51.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -146,7 +146,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
146
146
  static final int APPLICATION_EXIT_REASON_USER_REQUESTED = 10;
147
147
  static final int APPLICATION_EXIT_REASON_DEPENDENCY_DIED = 12;
148
148
 
149
- private final String pluginVersion = "8.51.10";
149
+ private final String pluginVersion = "8.51.11";
150
150
  private static final String DELAY_CONDITION_PREFERENCES = "";
151
151
 
152
152
  private SharedPreferences.Editor editor;
@@ -76,8 +76,8 @@ public class DownloadService extends Worker {
76
76
  public static final String DEFAULT_CHANNEL = "default_channel";
77
77
  public static final String IS_PROD = "is_prod";
78
78
  public static final String IS_EMULATOR = "is_emulator";
79
- // Match HTTP dispatcher so 64 workers actually fetch in parallel (HTTP/2 multiplexes).
80
- private static final int MANIFEST_MAX_CONCURRENT_FILES = 64;
79
+ // HTTP + decode share one pool. Cap by CPU: 8 on 4 cores, 16 on 8 cores, 64 max.
80
+ private static final int MANIFEST_MAX_CONCURRENT_FILES = manifestMaxConcurrentFiles();
81
81
  private static final String UPDATE_FILE = "update.dat";
82
82
 
83
83
  // Shared OkHttpClient to prevent resource leaks
@@ -103,6 +103,15 @@ public class DownloadService extends Worker {
103
103
  .build();
104
104
  }
105
105
 
106
+ static int manifestMaxConcurrentFiles() {
107
+ return manifestMaxConcurrentFiles(Runtime.getRuntime().availableProcessors());
108
+ }
109
+
110
+ static int manifestMaxConcurrentFiles(int processors) {
111
+ int cores = Math.max(1, processors);
112
+ return Math.min(64, Math.max(8, cores * 2));
113
+ }
114
+
106
115
  static String buildUserAgent(String appId, String pluginVersion, String versionOs) {
107
116
  return (
108
117
  "CapacitorUpdater/" +
@@ -96,7 +96,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
96
96
  deinit {
97
97
  implementation.shutdown()
98
98
  }
99
- private let pluginVersion: String = "8.51.10"
99
+ private let pluginVersion: String = "8.51.11"
100
100
  private let launchStartedAtMs = Int64(Date().timeIntervalSince1970 * 1000)
101
101
  static let updateUrlDefault = "https://plugin.capgo.app/updates"
102
102
  static let statsUrlDefault = "https://plugin.capgo.app/stats"
@@ -25,8 +25,12 @@ import UIKit
25
25
  private let PENDING_DELETE_IDS: String = "pendingDeleteIds"
26
26
  private var unzipPercent = 0
27
27
  private let TEMP_UNZIP_PREFIX: String = "capgo_unzip_"
28
- /// Match URLSession per-host limit so 64 workers actually fetch in parallel.
29
- private static let manifestMaxConcurrentFiles = 64
28
+ /// HTTP + decode share one pool. Cap by CPU: 8 on 4 cores, 16 on 8 cores, 64 max.
29
+ static let manifestMaxConcurrentFiles = clampedManifestConcurrency(processorCount: ProcessInfo.processInfo.processorCount)
30
+
31
+ static func clampedManifestConcurrency(processorCount: Int) -> Int {
32
+ min(64, max(8, max(1, processorCount) * 2))
33
+ }
30
34
  private static let emptySha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
31
35
  private let deletePaceSeconds: TimeInterval = 0.075
32
36
  private let deleteLock = NSLock()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-updater",
3
- "version": "8.51.10",
3
+ "version": "8.51.11",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Live update for capacitor apps",
6
6
  "main": "dist/plugin.cjs.js",