Skip to content

Commit 2f5421d

Browse files
committed
Feature: delay trafficMonitor start to prevent problems. set launch_fail_times up to 3
1 parent 114655c commit 2f5421d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ClashX/AppDelegate.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
120120
if let xx = x.object(forKey: "launch_fail_times") as? Int {launch_fail_times = xx }
121121
launch_fail_times += 1
122122
x.set(launch_fail_times, forKey: "launch_fail_times")
123-
if launch_fail_times > 1{
123+
if launch_fail_times > 3{
124124
//发生连续崩溃
125125
let path = (NSHomeDirectory() as NSString).appendingPathComponent("/.config/clash/")
126126
let documentDirectory = URL(fileURLWithPath: path)
@@ -159,7 +159,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
159159
run()
160160
}
161161
syncConfig(){
162-
self.resetTrafficMonitor()
162+
DispatchQueue.main.asyncAfter(deadline:DispatchTime.now() + 1, execute: {
163+
self.resetTrafficMonitor()
164+
})
163165
}
164166
}
165167

0 commit comments

Comments
 (0)