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: implement EboActor.onRequestFinalized handler #23

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

0xyaco
Copy link
Collaborator

@0xyaco 0xyaco commented Aug 15, 2024

🤖 Linear

Closes GRT-84

Description

Handle the RequestFinalized event. It simply terminates the EboActor and executes a callback that can be used by the EboProcessor to remove the request from the Map<requestId, EboActor>.

Copy link

linear bot commented Aug 15, 2024

GRT-84 Implement onFinalizeRequest

Actors should handle the event RequestFinalized from Prophet's Oracle.

This handler should:

  • Terminate the EboActor
    • Clear the registry
    • Call some onTerminate (or similarly named) callback, passed by EboProcessor to unlink the EboActor with its current request id

Comment on lines -52 to -55
export interface RequestFinalizable {
requestId: string;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Deleting stuff related to RequestFinalizable, as this case will be handled by the agent's periodic checks; not event related.

@0xyaco 0xyaco requested review from 0xkenj1 and 0xnigir1 August 15, 2024 20:20
Copy link
Collaborator

@0xnigir1 0xnigir1 left a comment

Choose a reason for hiding this comment

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

just one comment, everything else lgtm 🫡

Copy link
Collaborator

Choose a reason for hiding this comment

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

wdyt about having the callback function as parameter of the onRequestFinalized instead of the constructor?
it will make it obvious that the function will be called from there

Copy link
Collaborator Author

@0xyaco 0xyaco Aug 16, 2024

Choose a reason for hiding this comment

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

That's a great proposal, you got me thinking why did I go for this option lol 🤔

=== PR #24 spoiler ahead ===
There are some situations in which that onTerminate callback is being used outside the onRequestFinalized handler (eg the request was "escalated", so the agent stops tracking it as it will be handled by another system outside the EBO agent)

@0xyaco 0xyaco requested a review from 0xnigir1 August 16, 2024 13:55
Copy link
Collaborator

@0xkenj1 0xkenj1 left a comment

Choose a reason for hiding this comment

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

same comment, everything else looks good

@0xyaco 0xyaco merged commit 0f3aae4 into dev Aug 16, 2024
5 checks passed
@0xyaco 0xyaco deleted the feat/on-finalize-request branch August 16, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants