-
Notifications
You must be signed in to change notification settings - Fork 965
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
Implement internal pir opt out #5845
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
if (this is OptOutStep) { | ||
this.copy( | ||
brokerName = brokerName, | ||
profilesToOptOut = repository.getExtractProfileResultForBroker(brokerName)?.extractResults?.filter { |
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.
This step is only relevant for optout. We need to obtain the extracted profiles with result set to true (if any) - those are the considered valid records.
c1f28ce
to
dd9f7c2
Compare
return kotlin.runCatching { | ||
var attempt = 0 | ||
var result: Pair<ConfirmationStatus, String?> = Unknown to null | ||
while (attempt < MAX_AWAIT_EMAIL_ATTEMPT) { |
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.
It’s a bit slow today - this could take 90 seconds. However, it seems like we might need longer since I am not getting any links today.
import kotlinx.coroutines.withContext | ||
import logcat.logcat | ||
|
||
interface PirActionsRunner { |
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.
Moved this to common package which contains everything shared between scan and optout that is not necessarily script specific
state: State, | ||
callback: String, | ||
) { | ||
withContext(dispatcherProvider.main()) { |
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.
Seems like this doesn’t show anything visually but i can see the actions passing.
) { | ||
val broker = brokersToExecute[state.currentBrokerIndex] | ||
|
||
if (state.transactionID.isEmpty()) { |
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.
This is possible if we get an error in getcaptcha action. We just fail this rightaway.
), | ||
) | ||
} else { | ||
nativeBrokerActionHandler.pushAction( |
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.
The logic here polls for the solution until we hit max retries (50) every 5 seconds. We can update the frequency here - but so far it does take 2 minutes+ to get the solution
state: State, | ||
pollingIntervalSeconds: Float, | ||
) { | ||
val broker = brokersToExecute[state.currentBrokerIndex] |
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.
We might need to move out the polling to the runner since NativeBrokerActionHandler is shared across all runners. It is not a problem today because this is mainly used in opt out where we use only one runner.
} | ||
|
||
private suspend fun handleGetEmail(state: State) { | ||
val broker = brokersToExecute[state.currentBrokerIndex] |
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.
This handles getting email address to be used for opt out for every profile.
} | ||
|
||
@ContributesBinding(AppScope::class) | ||
class RealPirRunStateHandler @Inject constructor( |
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.
Extracted this class from the runner since that class is getting too big. This handles pixels and saving states to db
@@ -94,10 +93,15 @@ class RealPirScan @Inject constructor( | |||
lastName = "Smith", | |||
city = "Chicago", | |||
state = "IL", | |||
addresses = listOf(), | |||
addresses = listOf( |
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.
This is needed to get proper extracted profile matches (not documented anywhere)
Task/Issue URL: https://app.asana.com/0/72649045549333/1209848684552123/f ### Description See attached task description ### Steps to test this PR https://app.asana.com/0/72649045549333/1209848684552127/f
Task/Issue URL: https://app.asana.com/0/72649045549333/1209242689024725/f
Description
This PR covers all the logic for opt-out. More details in the attached task.
Steps to test this PR
No need to do a specific test for this PR.
The stacked PR’2 test case should cover all - since formatting is much better.