-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
New issue with .saveAll batch operation #47
Comments
There were definitely some changes to |
No worries. I'll run through it later tonight. I just confirmed commit: 3f1c897 works without issue. |
This part seems correct (ignoring the encoding error from earlier) the first success/failure will return a failure if there's a connection issue or something that didn't come from the server. The inside success/failure pertain to your objects directly. More details about how the server handles batch responses is here: https://docs.parseplatform.org/rest/guide/#batch-operations |
I agree. Makes sense - cheers. Saw your pending LiveQuery PR. You are a rockstar. |
Thanks! When it's ready, will you be able to test it since you have LiveQuery experience? |
My experience is from ~5 years ago, but will definitely contribute the little I can and test. |
I'm not able to replicate this. What version of the parse-server are you using? Below is the code I used in Playgrounds and didn't get any errors: struct GameScore1: ParseObject {
//: Those are required for Object
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
//: Your own properties
var score: [String]?
//custom initializer
init(score: [String]) {
self.score = score
}
}
let score = GameScore1(score: ["2"])
let score2 = GameScore1(score: ["3"])
let scoresArray = [score, score2]
scoresArray.saveAll { results in
switch results {
case .success(let success):
var index = 0
success.forEach { success in
switch success {
case .success(let savedScore):
print("Saved \"\(savedScore.className)\" with score \(savedScore.score) successfully")
if index == 1 {
print("\(savedScore)")
}
index += 1
case .failure(let error):
print("Error saving: \(error)") // <---All the objects fail now after the recent commits and scores are not updated remotely.
}
}
case .failure(let error):
print("Error batch saving: \(error)")
}
} |
Also, you mentioned a |
I'm running on a staging parse-server 4.5.0 with TLS. You're right - the example is wrong. I was trying to write it on the fly without referencing how I wrote it in staging. I think this is closer and runnable:
The error I get running this in Playground:
Makes me really think there may be something going on in the encoder. I'll try to dig in when I have some time. |
I may have gotten this wrong. Is this a fetchAll? Sorry - not This worked in the past commit I previously mentioned, but could easily have gotten this wrong. Playing around with the code, my individual HTTP methods seem to be POST, as well as the POST for the batch operation. Is this correct? I would have expected PUT for the individual methods with a POST for the overall batch operation. How do I properly batch update? Cheers! |
I meant to say all I see is
The objects were most likely going through the wrong encoder in the older commits.
It matters which |
Makes sense. Thanks @cbaker6 |
Sorry @cbaker6 but I'm having a new issue with .saveAll batch save/update operation since one of the last two commits.
I can't imagine it's because of the cloudcode name changes from #46 but maybe there is a cloud code that runs in parse-server source that I am not aware of. I scanned through #43 and I'm going to take a flyer and say it might be the skippedKeys or other changes to the
batch
command in API+Commands.swift. I don't see the error but I don't know enough about the return headers and body to know how it is encoded.Also, I think Parse has always done this, but I get a success response with an array of parseerrors. So, it's a success but the saveAll failed.
Here's the code:
I thought there may be some issue with a pointer, missing column, or my key strings in query, because
Invalid field name:__type.
in the response, but after some inspection it seems to be a potential issue with encoding the query. Everything is in order and looking at history, it seemed to work before. I could be wrong of course. I may try rolling back and testing, but for now, it would be nice to have another pair of eyes who knows Parse-Swift well.There are no issues updating remote objects, if I do a for-loop and do individual
.save
.The text was updated successfully, but these errors were encountered: