contentful.swift icon indicating copy to clipboard operation
contentful.swift copied to clipboard

fetch and fetchArray consistently taking upwards of 2s

Open nickpappas-underdogfantasy opened this issue 1 year ago • 1 comments

  • contentful.swift version number: 5.5.7
  • Xcode version number: Xcode 15.2
  • Target operating system(s) and version number(s)
    • [x] iOS:
    • [ ] tvOS:
    • [ ] watchOS:
    • [ ] macOS:
  • Package manager:
    • [ ] Carthage
    • [ ] Cocoapods
    • [X] SPM

We are noticing that fetch and fetchArray are taking between 1.5-2.5s on average when trying to fetch an entry by ID. Per network logs, it looks like the response comes back super quick, but hangs in the SDK for 1-2s. This seems to be isolated to iOS as Android is using the exact same entry and only experiencing 200-300ms response time from their equivalent SDK method (.one).

Please let me know if we are doing something wrong here:

        let content: PromoModel = try await withCheckedThrowingContinuation { continuation in
            client.fetch(PromoModel.self, id: Content.homepageBanners.id) { result in
                switch result {
                case .success(let promos):
                    continuation.resume(returning: promos)
                case .failure(let error):
                    continuation.resume(throwing: error)
                }
            }
        }

I have start and end times captured before and after this fetch and have isolated the wait to be here.

This is the same issue we are facing in version 5.5.13 as well.. Support ticket for reference: https://support.contentful.com/hc/en-us/requests/196078

swayambhu-banerjee avatar May 29 '25 14:05 swayambhu-banerjee