contentful / contentful.swift

A delightful Swift interface to Contentful's content delivery API.
MIT License
203 stars 81 forks source link

fetch and fetchArray consistently taking upwards of 2s #393

Open nickpappas-underdogfantasy opened 4 months ago

nickpappas-underdogfantasy commented 4 months ago

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.