Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting explicit autorelease frequency #579

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/AutomaticEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AutomaticEvents: NSObject, SKPaymentTransactionObserver, SKProductsRequest
var sessionStartTime: TimeInterval = Date().timeIntervalSince1970
var hasAddedObserver = false

let awaitingTransactionsWriteLock = DispatchQueue(label: "com.mixpanel.awaiting_transactions_writeLock", qos: .userInitiated)
let awaitingTransactionsWriteLock = DispatchQueue(label: "com.mixpanel.awaiting_transactions_writeLock", qos: .userInitiated, autoreleaseFrequency: .workItem)

func initializeEvents(instanceName: String) {
let legacyFirstOpenKey = "MPFirstOpen"
Expand Down
2 changes: 1 addition & 1 deletion Sources/Flush.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Flush: AppLifecycle {

required init(basePathIdentifier: String) {
self.flushRequest = FlushRequest(basePathIdentifier: basePathIdentifier)
flushIntervalReadWriteLock = DispatchQueue(label: "com.mixpanel.flush_interval.lock", qos: .utility, attributes: .concurrent)
flushIntervalReadWriteLock = DispatchQueue(label: "com.mixpanel.flush_interval.lock", qos: .utility, attributes: .concurrent, autoreleaseFrequency: .workItem)
}

func flushQueue(_ queue: Queue, type: FlushType) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Mixpanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ final class MixpanelManager {
instances = [String: MixpanelInstance]()
Logger.addLogging(PrintLogging())
readWriteLock = ReadWriteLock(label: "com.mixpanel.instance.manager.lock")
instanceQueue = DispatchQueue(label: "com.mixpanel.instance.manager.instance", qos: .utility)
instanceQueue = DispatchQueue(label: "com.mixpanel.instance.manager.instance", qos: .utility, autoreleaseFrequency: .workItem)
}

func initialize(token apiToken: String,
Expand Down
4 changes: 2 additions & 2 deletions Sources/MixpanelInstance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ open class MixpanelInstance: CustomDebugStringConvertible, FlushDelegate, AEDele
)
#endif
let label = "com.mixpanel.\(self.apiToken)"
trackingQueue = DispatchQueue(label: "\(label).tracking)", qos: .utility)
networkQueue = DispatchQueue(label: "\(label).network)", qos: .utility)
trackingQueue = DispatchQueue(label: "\(label).tracking)", qos: .utility, autoreleaseFrequency: .workItem)
networkQueue = DispatchQueue(label: "\(label).network)", qos: .utility, autoreleaseFrequency: .workItem)
self.name = name

mixpanelPersistence = MixpanelPersistence.init(instanceName: name)
Expand Down
2 changes: 1 addition & 1 deletion Sources/ReadWriteLock.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ReadWriteLock {
let concurentQueue: DispatchQueue

init(label: String) {
self.concurentQueue = DispatchQueue(label: label, qos: .utility, attributes: .concurrent)
self.concurentQueue = DispatchQueue(label: label, qos: .utility, attributes: .concurrent, autoreleaseFrequency: .workItem)
}

func read(closure: () -> Void) {
Expand Down