Generate unique identifier for each TranserUtility instance upon setup #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First off, I want to thank you for your work on this package. This thing runs like a boss! Very cool!
Problem
In development and testing, we often encountered the issue described in #9 but brushed it off in light of the fact that it seemed to be more of a development pain than something critical. Once our iOS implementation went into QA, however, the issue came back into question for the following reason:
The basic credentials we use to authenticate TransferUtility have a one hour expiration. As such, after an hour has elapsed, we must update the credentials originally used to setup the package. Once
setupWithBasic
is invoked a second time, a new TransferUtility instance would be created using the same static key and then subscriptions would no longer bubble up to the JavaScript module.I should note that ths is not a problem on Android.
I spent yesterday trying to determine a sound resolution to this issue but nothing obvious came together (perhaps a result of my lack of experience with both Obj-C and the AWS SDK on iOS). I was able to determine that simply unregistering the TransferUtility instance upon subsequent setups seemed to be problematic.
Proposed Solution
Largely in the interest of getting something working, I came came up with the revision I present in this PR. The basic change is pretty simple:
Additionally the logic surrounding the
alreadyInitialize
property was removed as it is no longer necessary, as the full setup process is expected to run regardless.Potential Concerns
My concern with the current codebase is that old TransferUtility instances are not currently handled.
My first thought was memory leak however after doing some local testing and repeatedly creating new instances, I didn't experience any severe impacts in terms of RAM consumption or stability... needless to say, it still feels sloppy.
I'd be open to adjustments in cleaning this aspect up if the rest of the implementation seems reasonable.
Looking forward to hearing back. Thanks again for your stellar work on this!
Eran