-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Added ODPManager implementation #322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
dd028bf
Initial ODP Manager
mikechu-optimizely a317407
Outline unit tests
mikechu-optimizely 443164c
WIP Unit tests + changes to CUD
mikechu-optimizely faea784
Implement fetch, identify, and send events with Builder pattern
mikechu-optimizely 191a6ec
WIP Fixing final unit test
mikechu-optimizely f6276bc
Finish unit tests
mikechu-optimizely 4f629fa
Add documentation
mikechu-optimizely bbf8ac1
Lint fixes
mikechu-optimizely 4a54b4c
Pull request code revisions + additional unit tests
mikechu-optimizely 0995694
Lint fixes
mikechu-optimizely 88b6684
Change to use string array over List
mikechu-optimizely 29514ff
Clean usings
mikechu-optimizely 22b04ae
Add new OdpConfig test
mikechu-optimizely dcafcee
Small refactors
mikechu-optimizely 8747556
Pull request code review changes
mikechu-optimizely dfaa27b
Code review changes
mikechu-optimizely c528dce
Mark _odpConfig as volatile
mikechu-optimizely a5b28e6
Return `volatile` denotation
mikechu-optimizely File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Code review changes
- Loading branch information
commit dfaa27b24faea51b2e901d8a68da1dbca135ea1f
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ public class OdpManager : IOdpManager, IDisposable | |
/// <summary> | ||
/// Configuration used to communicate with ODP | ||
/// </summary> | ||
private volatile OdpConfig _odpConfig; | ||
private OdpConfig _odpConfig; | ||
|
||
/// <summary> | ||
/// Manager used to handle audience segment membership | ||
|
@@ -69,11 +69,6 @@ public bool UpdateSettings(string apiKey, string apiHost, List<string> segmentsT | |
|
||
_odpConfig = newConfig; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When ODPConfig is updated, the OdpConfig object itself is replaced in ODPManager, while copying fields in ODPEventManager and ODPSegmentManager. Can we make it consistent in either way? |
||
|
||
// flush old events using old odp publicKey (if exists) before updating odp key. | ||
// NOTE: It should be rare but possible that odp public key is changed for the same datafile (sdkKey). | ||
// - Try to send all old events with the previous public key. | ||
// - If it fails to flush all the old events here (network error), remaining events will be discarded. | ||
EventManager.Flush(); | ||
EventManager.UpdateSettings(_odpConfig); | ||
|
||
SegmentManager.ResetCache(); | ||
|
@@ -218,12 +213,7 @@ public OdpManager Build(bool asEnabled = true) | |
{ | ||
_logger = _logger ?? new DefaultLogger(); | ||
_errorHandler = _errorHandler ?? new NoOpErrorHandler(); | ||
|
||
if (_odpConfig == null) | ||
{ | ||
_logger.Log(LogLevel.ERROR, "ODP Config via WithOdpConfig() required."); | ||
return null; | ||
} | ||
_odpConfig = _odpConfig ?? new OdpConfig(); | ||
|
||
var manager = new OdpManager | ||
{ | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you remove "volitile" here? Multiple thread read/write it here too.