Skip to content

Commit

Permalink
Disable resolution stacktraces by default to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
EricRabil committed Aug 11, 2022
1 parent f57afe6 commit 28b6580
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/Pwomise/Pwomise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ private let dispatch_get_current_queue = dlsym(dlopen(nil, RTLD_GLOBAL), "dispat
unsafeBitCast($0, to: dispatch_get_current_queue_t.self)
}

public struct PromiseRuntime {
/// Enable this when debugging double-resolve errors to locate the first resolver
public static var recordResolutionStackTrace = false
}
public class Promise<Output>: CustomDebugStringConvertible {
internal typealias Pending = PendingPromise<Output, Error>
public typealias Completion = Result<Output, Error>
Expand Down Expand Up @@ -114,7 +118,9 @@ public class Promise<Output>: CustomDebugStringConvertible {
return
}

resolutionStackTrace = Thread.callStackSymbols
if PromiseRuntime.recordResolutionStackTrace {
resolutionStackTrace = Thread.callStackSymbols
}
}
}

Expand Down

0 comments on commit 28b6580

Please sign in to comment.