amplify-swift icon indicating copy to clipboard operation
amplify-swift copied to clipboard

How to set timeout and maximum retry in AWSCognitoIdentityUser?

Open saravr opened this issue 4 years ago • 5 comments

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:

saravr avatar Feb 08 '21 09:02 saravr

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.

royjit avatar Feb 10 '21 15:02 royjit

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.

github-actions[bot] avatar Jun 19 '21 00:06 github-actions[bot]

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 avatar Sep 21 '22 16:09 royjit

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.

mateusforgi avatar Sep 22 '22 18:09 mateusforgi

Thanks for the feedback, your use case makes sense. I have merged in your PR and will be released in the next version.

royjit avatar Sep 26 '22 18:09 royjit

This is released in the version v1.28.2

royjit avatar Oct 26 '22 22:10 royjit