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

feat: add subintent polling #289

Merged
merged 7 commits into from
Dec 4, 2024
Merged

Conversation

dawidsowardx
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Dec 3, 2024

Phylum Report Link

@dawidsowardx dawidsowardx force-pushed the add-subintent-status-polling branch from 00bf7bb to aa013d8 Compare December 3, 2024 14:36
@@ -28,18 +28,20 @@ export type RadixButtonMode = keyof typeof RadixButtonMode
export type PersonaData = { field: string; value: string }

export const RequestStatus = {
fail: 'fail',
Copy link
Collaborator

Choose a reason for hiding this comment

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

either we use past tense of stick with present

failed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just moved it up in this const, we do not use RequestStatus.fail everywhere but pure string as well so I'm hesitant to changing this to failed

packages/common/src/index.ts Outdated Show resolved Hide resolved
.map(({ subintent_status }) => subintent_status),
new Set<SubintentStatus>(['CommittedSuccess']),
backoff,
) as ResultAsync<SubintentStatus, SdkError>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

make poll generic and add SubintentStatus to the output signature

)

const preauthorizationPollingLoop = async () => {
await requestItemModule.getLookedUp().andThen((lookedUpItems) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

not clear what lookedUp is. Can we change this to getUnconfirmedTransactions or getUnresolvedTransactions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it should align with request item status so what do you say for getPendingCommit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

getPendingCommit is great

)
activePolling.set(item.interactionId, polling)
polling.result.andTee((result) => {
requestItemModule.updateStatus({
Copy link
Collaborator

Choose a reason for hiding this comment

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

not awaiting the updateStatus promise to resolve. Is this intentional?

Copy link
Collaborator

Choose a reason for hiding this comment

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

what if the polling result is an error? Shouldn't that update the status of the request item?

Copy link
Contributor Author

@dawidsowardx dawidsowardx Dec 3, 2024

Choose a reason for hiding this comment

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

not awaiting the updateStatus promise to resolve. Is this intentional?

I changed it however polling.result is not awaited so it doesn't really matter if updateStatus is.

what if the polling result is an error? Shouldn't that update the status of the request item?

I don't think it should. What's the reason of the failure? I changed it so if polling failed it starts again 🤡

@dawidsowardx dawidsowardx requested a review from xstelea December 3, 2024 16:52
@dawidsowardx dawidsowardx merged commit 510127a into develop Dec 4, 2024
11 checks passed
@dawidsowardx dawidsowardx deleted the add-subintent-status-polling branch December 4, 2024 16:21
Copy link

github-actions bot commented Dec 4, 2024

🎉 This PR is included in version 2.2.0-dev.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants