amplify-swift
amplify-swift copied to clipboard
How to set timeout and maximum retry in AWSCognitoIdentityUser?
State your question
How to change retry and timeout values for signin/up operations with AWS Cognito Identity module?
Which AWS Services are you utilizing?
Cognito, S3, IAM, CloudFront, etc.
Provide code snippets (if applicable)
I tried setting it like below
let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2, identityPoolId: Constants.IDENTITY_POOL_ID)
configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialsProvider)
configuration.allowsCellularAccess = true
configuration.maxRetryCount = 1
configuration.timeoutIntervalForRequest = 1
configuration.timeoutIntervalForResource = 1
AWSServiceManager.default().defaultServiceConfiguration = configuration
and
try Amplify.add(plugin: AWSCognitoAuthPlugin())
try Amplify.add(plugin: AWSS3StoragePlugin())
try Amplify.configure()
But I still the login requests take about 4 mins to finally fail (when network is disabled)
Environment(please complete the following information):
- SDK Version: Amplify 1.5.0
- Dependency Manager: Cocoapods
- Swift Version : 5.0
Device Information (please complete the following information):
- Device: [e.g. iPhone6, Simulator]
- iOS Version: iOS 14
- Specific to simulators:
Setting the retry timeout is not currently supported in Amplify. We will take this as a feature request and will update here when we have more info.
This issue is stale because it has been open for 14 days with no activity. Please, provide an update or it will be automatically closed in 7 days.
Could you please give us the use case of this requirement? Trying to understand why the current retry mechanism is not working for you.
Could you please give us the use case of this requirement? Trying to understand why the current retry mechanism is not working for you.
@royjit in my case, 4 minutes of timeout (1 minute for each retry) gives a really bad user experience for the user. Our app gives support for remote areas when if we are luck 3g is available. So for instance, showing a loading spinner on the login view for 4 minutes gives the user the impression that app is broken.
Thanks for the feedback, your use case makes sense. I have merged in your PR and will be released in the next version.
This is released in the version v1.28.2