Skip to content
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
11 changes: 7 additions & 4 deletions RelayKit/Client/ClientBuilderProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Foundation
/// ```swift
/// let client = try await ClientBuilderProxy()
/// .homeserverUrl("https://matrix.org")
/// .sessionPaths(dataPath: dataDir, cachePath: cacheDir)
/// .sessionPaths(dataPath: dataDir, cachePath: cacheDir, poolMaxSize: 4)
/// .build()
/// ```
///
Expand All @@ -38,7 +38,7 @@ import Foundation
/// - ``homeserverUrl(_:)``
/// - ``serverName(_:)``
/// - ``serverNameOrHomeserverUrl(_:)``
/// - ``sessionPaths(dataPath:cachePath:)``
/// - ``sessionPaths(dataPath:cachePath:poolMaxSize:)``
/// - ``username(_:)``
///
/// ### Building
Expand Down Expand Up @@ -86,10 +86,13 @@ public final class ClientBuilderProxy: @unchecked Sendable {
/// - Parameters:
/// - dataPath: The path for persistent data.
/// - cachePath: The path for cache data.
/// - poolMaxSize: The maximum number of SQLite connections per store.
/// - Returns: This builder for chaining.
@discardableResult
public func sessionPaths(dataPath: String, cachePath: String) -> ClientBuilderProxy {
builder = builder.sessionPaths(dataPath: dataPath, cachePath: cachePath)
public func sessionPaths(dataPath: String, cachePath: String, poolMaxSize: UInt32) -> ClientBuilderProxy {
let store = SqliteStoreBuilder(dataPath: dataPath, cachePath: cachePath)
.poolMaxSize(poolMaxSize: poolMaxSize)
builder = builder.sqliteStore(config: store)
return self
}

Expand Down
5 changes: 4 additions & 1 deletion RelayKit/Services/AuthenticationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ final class AuthenticationService {
return ClientBuilderProxy()
.sessionPaths(
dataPath: Self.dataDirectory.path,
cachePath: Self.cacheDirectory.path
cachePath: Self.cacheDirectory.path,
// The SDK default is four connections per physical CPU for each store,
// which can exhaust macOS file descriptors on high-core-count systems.
poolMaxSize: 4
)
.slidingSyncVersionBuilder(.discoverNative)
.autoEnableCrossSigning(true)
Expand Down
Loading