[MOB-22537] - added processing of listeners asynchronously inside serial queue#126
Conversation
Sources/AEPOptimize/Optimize.swift
Outdated
| "Cannot process the update propositions request event, Configuration shared state is not available.") | ||
| return | ||
| } | ||
| queue.async { |
There was a problem hiding this comment.
should we capture [weak self] here as well to prevent a strong reference to self on line 203?
| - AEPCore (< 6.0.0, >= 5.0.0) | ||
| - AEPServices (< 6.0.0, >= 5.0.0) | ||
| - AEPCore (5.3.1): | ||
| - AEPCore (5.4.0): |
There was a problem hiding this comment.
let's be sure these updated dependency versions are represented in the podspec and Package.swift files
| XCTAssertEqual(1, updateEventIdsInProgress.count) | ||
| XCTAssertEqual([DecisionScope(name: "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTExMTExMTExMTExMTExMSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExMTExMTExMTExMTExMTEifQ==")], updateEventIdsInProgress.values.first) | ||
| // using DispatchQueue to change the run loop as the events are now being processed inside a serial queue in optimize extension | ||
| DispatchQueue.main.async { [weak self] in |
There was a problem hiding this comment.
probably better to run these lines on a global (bg) thread than the main thread
There was a problem hiding this comment.
I tried using background thread, but on running the tests there were inconsistency as a few of them used to fail because of the same reason we used a DispatchQueue to change the run loop (Assertions are executed before the events get processed).
sbenedicadb
left a comment
There was a problem hiding this comment.
couple small comments that need to be addressed
|
Hi @sbenedicadb thanks a lot for reviewing. I have addressed your comments and made relevant changes in the PR. Would request you to kindly check and review again. |
Description
This PR solves race condition issue observed in Optimize SDK.
Jira Link - MOB-22537
When a personalization request is made to edge, our propositionsInProgress dictionary is returned from parent's repsonseEvent before it gets updated in processEdgeResponse. We are now processing our listeners in a serial queue to solve this.
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: