Uh oh!
There was an error while loading. Please reload this page.
Replace Promise and Future with async/await - #689
Conversation
ivan-ushakov
commented
Oct 17, 2021
Will do this step by step to avoid a lot of changes in one PR (hard to review). |
tomholub
commented
Oct 17, 2021
Let me know once it's ready for merging. |
| var messages: [Message] = [] | ||
| for identifier in messageIdentifiers { | ||
| messages.append(try await fetchFullMessage(with: identifier)) | ||
| } |
There was a problem hiding this comment.
In a separate issue, should make sure these pull in parallel instead of sequentially.
| return Promise { resolve, reject in | ||
| return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<GTLRGmail_ListMessagesResponse, Error>) in | ||
| self.gmailService.executeQuery(query) { _, data, error in | ||
| if let error = error { | ||
| reject(GmailServiceError.providerError(error)) | ||
| continuation.resume(throwing: GmailServiceError.providerError(error)) | ||
| return | ||
| } |
There was a problem hiding this comment.
I suppose this is because self.gmailService.executeQuery is not async yet?
There was a problem hiding this comment.
gmailService has type GTLRService and this is third party code in objc. We could create Swift wrapper with async methods but not sure this worth it.
ivan-ushakov
commented
Oct 18, 2021
I think it is ready. We could do multiple PR for #404 but |
tomholub
commented
Oct 18, 2021
When you don't want to close an issue, write |
close#404
Tests(delete all except exactly one):
To be filled by reviewers
I have reviewed that this PR... (tick whichever items you personally focused on during this review):