mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-30 04:28:44 +00:00
Expose Configuration.readQoS and writeQoS
This helps tools that perform their own asynchronous jobs that depend on database scheduling. By using the same QoS as the database, they won't create priority inversion or similar scheduling misuses.
This commit is contained in:
1 parent
5d50e396c1
commit
6dc4d50e00
1 file changed
+9
-2
@@ -46,6 +46,8 @@ import Foundation
|
||||
/// ### Configuring the Quality of Service
|
||||
///
|
||||
/// - ``qos``
|
||||
/// - ``readQoS``
|
||||
/// - ``writeQoS``
|
||||
/// - ``targetQueue``
|
||||
/// - ``writeTargetQueue``
|
||||
public struct Configuration {
|
||||
@@ -337,11 +339,16 @@ public struct Configuration {
|
||||
/// The default is `userInitiated`.
|
||||
public var qos: DispatchQoS = .userInitiated
|
||||
|
||||
/// The quality of service of read accesses
|
||||
var readQoS: DispatchQoS {
|
||||
/// The effective quality of service of read-only database accesses.
|
||||
public var readQoS: DispatchQoS {
|
||||
targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// The effective quality of service of write database accesses.
|
||||
public var writeQoS: DispatchQoS {
|
||||
writeTargetQueue?.qos ?? targetQueue?.qos ?? self.qos
|
||||
}
|
||||
|
||||
/// The target dispatch queue for database accesses.
|
||||
///
|
||||
/// Database connections which are not read-only will prefer
|
||||
|
||||
Reference in new issue
Block a user