Skip to content
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

Disable priority queue for mobile requests #1023

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class IncomingRequestRepositoryImpl @Inject constructor(
// Put high priority item below any internal request and mobile connect requests
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment should maybe updated too.

val index = requestQueue.indexOfFirst {
val item = it as? QueueItem.RequestItem
item != null && !item.incomingRequest.isInternal && !item.incomingRequest.isMobileConnectRequest
item != null && !item.incomingRequest.isInternal
}
if (index != -1) {
requestQueue.add(index, QueueItem.HighPriorityScreen)
Expand Down Expand Up @@ -179,6 +179,7 @@ class IncomingRequestRepositoryImpl @Inject constructor(
if (queueItem == null) {
Timber.w("Request with id $requestId is null")
}
Timber.d("\uD83D\uDDC2 get request $requestId")
return (queueItem as? QueueItem.RequestItem)?.incomingRequest
}

Expand All @@ -194,7 +195,6 @@ class IncomingRequestRepositoryImpl @Inject constructor(
// In order to emit an incoming request, the topmost item should be
// a. An incoming request
// b. It should not be the same as the one being handled already
Timber.d("Next request id ${(nextRequest as? QueueItem.RequestItem)?.incomingRequest?.interactionId}")
if (nextRequest is QueueItem.RequestItem && _currentRequestToHandle.value != nextRequest.incomingRequest) {
_currentRequestToHandle.emit(nextRequest.incomingRequest)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@ class MainViewModel @Inject constructor(
verifyingDappRequestJob = viewModelScope.launch {
verifyDappUseCase(request).onSuccess { verified ->
if (verified) {
if (request.isMobileConnectRequest) {
incomingRequestRepository.addPriorityRequest(request)
} else {
incomingRequestRepository.add(request)
}
// TODO temporarily disabled for the 1.7.0 release. This will be included in the next release.
// if (request.isMobileConnectRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment would help in case we don't come back to this promptly.

// incomingRequestRepository.addPriorityRequest(request)
// } else {
incomingRequestRepository.add(request)
// }
}
}.onFailure { error ->
if (error is RadixWalletException.DappRequestException) {
Expand Down
Loading