Skip to content

Commit 1ee4da1

Browse files
authored
Don't use transactions by default for internal SDK calls (#158)
* Don't use transactions by default for internal SDK calls * Prepare for new release
1 parent b064000 commit 1ee4da1

File tree

9 files changed

+35
-17
lines changed

9 files changed

+35
-17
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# Parse-Swift Changelog
22

33
### main
4-
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.8.0...main)
4+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.8.1...main)
55
* _Contributing to this repo? Add info about your change here to be included in the next release_
66

7+
### 1.8.0
8+
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.8.0...1.8.1)
9+
710
__Improvements__
811
- Append instead of replace when using query select, exclude, include, and fields ([#155](https://github.com/parse-community/Parse-Swift/pull/155)), thanks to [Corey Baker](https://github.com/cbaker6).
912

13+
__Fixes__
14+
- Transactions currently don't work when using mongoDB(postgres does work) on the parse-server. Internal use of transactions are disabled by default. If you want the Swift SDK to use transactions internally, you need to set useTransactionsInternally=true when configuring the client. It is recommended not to use transactions if you are using mongoDB until it's fixed on the server ([#158](https://github.com/parse-community/Parse-Swift/pull/158)), thanks to [Corey Baker](https://github.com/cbaker6).
15+
1016
### 1.8.0
1117
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.7.2...1.8.0)
1218

ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ var score2ForFetchedLater: GameScore?
114114
}
115115

116116
//: Saving multiple GameScores at once using a transaction.
117-
[score, score2].saveAll(transaction: true) { results in
117+
//: Currently doesn't work on mongo
118+
/*[score, score2].saveAll(transaction: true) { results in
118119
switch results {
119120
case .success(let otherResults):
120121
var index = 0
@@ -134,7 +135,7 @@ var score2ForFetchedLater: GameScore?
134135
case .failure(let error):
135136
assertionFailure("Error saving: \(error)")
136137
}
137-
}
138+
}*/
138139

139140
//: Save synchronously (not preferred - all operations on main queue).
140141
let savedScore: GameScore?
@@ -270,7 +271,7 @@ do {
270271
}
271272

272273
//: Asynchronously (preferred way) deleteAll GameScores based on it's objectId alone.
273-
[scoreToFetch, score2ToFetch].deleteAll(transaction: true) { result in
274+
[scoreToFetch, score2ToFetch].deleteAll { result in
274275
switch result {
275276
case .success(let deletedScores):
276277
deletedScores.forEach { result in

ParseSwift.playground/Sources/Common.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ public func initializeParse() {
55
ParseSwift.initialize(applicationId: "applicationId",
66
clientKey: "clientKey",
77
masterKey: "masterKey",
8-
serverURL: URL(string: "http://localhost:1337/1")!)
8+
serverURL: URL(string: "http://localhost:1337/1")!,
9+
useTransactionsInternally: false)
910
}
1011

1112
public func initializeParseCustomObjectId() {

ParseSwift.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "ParseSwift"
3-
s.version = "1.8.0"
3+
s.version = "1.8.1"
44
s.summary = "Parse Pure Swift SDK"
55
s.homepage = "https://github.com/parse-community/Parse-Swift"
66
s.authors = {

ParseSwift.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@
24252425
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
24262426
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
24272427
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2428-
MARKETING_VERSION = 1.8.0;
2428+
MARKETING_VERSION = 1.8.1;
24292429
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
24302430
PRODUCT_NAME = ParseSwift;
24312431
SKIP_INSTALL = YES;
@@ -2449,7 +2449,7 @@
24492449
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
24502450
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
24512451
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2452-
MARKETING_VERSION = 1.8.0;
2452+
MARKETING_VERSION = 1.8.1;
24532453
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
24542454
PRODUCT_NAME = ParseSwift;
24552455
SKIP_INSTALL = YES;
@@ -2515,7 +2515,7 @@
25152515
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25162516
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
25172517
MACOSX_DEPLOYMENT_TARGET = 10.13;
2518-
MARKETING_VERSION = 1.8.0;
2518+
MARKETING_VERSION = 1.8.1;
25192519
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
25202520
PRODUCT_NAME = ParseSwift;
25212521
SDKROOT = macosx;
@@ -2541,7 +2541,7 @@
25412541
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
25422542
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
25432543
MACOSX_DEPLOYMENT_TARGET = 10.13;
2544-
MARKETING_VERSION = 1.8.0;
2544+
MARKETING_VERSION = 1.8.1;
25452545
PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift;
25462546
PRODUCT_NAME = ParseSwift;
25472547
SDKROOT = macosx;
@@ -2688,7 +2688,7 @@
26882688
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
26892689
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
26902690
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2691-
MARKETING_VERSION = 1.8.0;
2691+
MARKETING_VERSION = 1.8.1;
26922692
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
26932693
MTL_FAST_MATH = YES;
26942694
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
@@ -2717,7 +2717,7 @@
27172717
INFOPLIST_FILE = "ParseSwift-watchOS/Info.plist";
27182718
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
27192719
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2720-
MARKETING_VERSION = 1.8.0;
2720+
MARKETING_VERSION = 1.8.1;
27212721
MTL_FAST_MATH = YES;
27222722
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-watchOS";
27232723
PRODUCT_NAME = ParseSwift;
@@ -2744,7 +2744,7 @@
27442744
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
27452745
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
27462746
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2747-
MARKETING_VERSION = 1.8.0;
2747+
MARKETING_VERSION = 1.8.1;
27482748
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
27492749
MTL_FAST_MATH = YES;
27502750
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
@@ -2772,7 +2772,7 @@
27722772
INFOPLIST_FILE = "ParseSwift-tvOS/Info.plist";
27732773
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
27742774
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2775-
MARKETING_VERSION = 1.8.0;
2775+
MARKETING_VERSION = 1.8.1;
27762776
MTL_FAST_MATH = YES;
27772777
PRODUCT_BUNDLE_IDENTIFIER = "com.parse.ParseSwift-tvOS";
27782778
PRODUCT_NAME = ParseSwift;

Scripts/jazzy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bundle exec jazzy \
55
--author_url http://parseplatform.org \
66
--github_url https://github.com/parse-community/Parse-Swift \
77
--root-url http://parseplatform.org/Parse-Swift/api/ \
8-
--module-version 1.8.0 \
8+
--module-version 1.8.1 \
99
--theme fullwidth \
1010
--skip-undocumented \
1111
--output ./docs/api \

Sources/ParseSwift/Objects/ParseObject.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ extension ParseObject {
725725
// MARK: Savable Encodable Version
726726
internal extension ParseType {
727727
func saveAll(objects: [ParseType],
728-
transaction: Bool = true,
728+
transaction: Bool = ParseSwift.configuration.useTransactionsInternally,
729729
options: API.Options = []) throws -> [(Result<PointerType, ParseError>)] {
730730
try API.NonParseBodyCommand<AnyCodable, PointerType>
731731
.batch(objects: objects,

Sources/ParseSwift/Parse.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public struct ParseConfiguration {
2626
/// Allows objectIds to be created on the client.
2727
var allowCustomObjectId = false
2828

29+
/// Use transactions inside the Client SDK.
30+
/// - warning: This is experimental and known not to work with mongoDB.
31+
var useTransactionsInternally = false
32+
2933
internal var authentication: ((URLAuthenticationChallenge,
3034
(URLSession.AuthChallengeDisposition,
3135
URLCredential?) -> Void) -> Void)?
@@ -57,6 +61,7 @@ public struct ParseConfiguration {
5761
serverURL: URL,
5862
liveQueryServerURL: URL? = nil,
5963
allowCustomObjectId: Bool = false,
64+
useTransactionsInternally: Bool = false,
6065
keyValueStore: ParseKeyValueStore? = nil,
6166
authentication: ((URLAuthenticationChallenge,
6267
(URLSession.AuthChallengeDisposition,
@@ -67,6 +72,7 @@ public struct ParseConfiguration {
6772
self.serverURL = serverURL
6873
self.liveQuerysServerURL = liveQueryServerURL
6974
self.allowCustomObjectId = allowCustomObjectId
75+
self.useTransactionsInternally = useTransactionsInternally
7076
self.mountPath = "/" + serverURL.pathComponents
7177
.filter { $0 != "/" }
7278
.joined(separator: "/")
@@ -153,6 +159,7 @@ public struct ParseSwift {
153159
serverURL: URL,
154160
liveQueryServerURL: URL? = nil,
155161
allowCustomObjectId: Bool = false,
162+
useTransactionsInternally: Bool = false,
156163
keyValueStore: ParseKeyValueStore? = nil,
157164
migrateFromObjcSDK: Bool = false,
158165
authentication: ((URLAuthenticationChallenge,
@@ -165,6 +172,7 @@ public struct ParseSwift {
165172
serverURL: serverURL,
166173
liveQueryServerURL: liveQueryServerURL,
167174
allowCustomObjectId: allowCustomObjectId,
175+
useTransactionsInternally: useTransactionsInternally,
168176
keyValueStore: keyValueStore,
169177
authentication: authentication),
170178
migrateFromObjcSDK: migrateFromObjcSDK)
@@ -176,6 +184,7 @@ public struct ParseSwift {
176184
serverURL: URL,
177185
liveQueryServerURL: URL? = nil,
178186
allowCustomObjectId: Bool = false,
187+
useTransactionsInternally: Bool = false,
179188
keyValueStore: ParseKeyValueStore? = nil,
180189
migrateFromObjcSDK: Bool = false,
181190
testing: Bool = false,
@@ -188,6 +197,7 @@ public struct ParseSwift {
188197
serverURL: serverURL,
189198
liveQueryServerURL: liveQueryServerURL,
190199
allowCustomObjectId: allowCustomObjectId,
200+
useTransactionsInternally: useTransactionsInternally,
191201
keyValueStore: keyValueStore,
192202
authentication: authentication),
193203
migrateFromObjcSDK: migrateFromObjcSDK)

Sources/ParseSwift/ParseConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
enum ParseConstants {
1212
static let sdk = "swift"
13-
static let version = "1.8.0"
13+
static let version = "1.8.1"
1414
static let hashingKey = "parseSwift"
1515
static let fileManagementDirectory = "parse/"
1616
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"

0 commit comments

Comments
 (0)