-
Notifications
You must be signed in to change notification settings - Fork 0
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: on last event #34
Conversation
GRT-153 Implement onNewEvent handler
Actor needs to react to the last known event by executing some RPCs. AC:
|
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.
Left some comments/questions but otherwise looking good 👍🏻
return; | ||
private async onLastEvent(event: EboEvent<EboEventName>) { | ||
switch (event.name) { | ||
case "RequestCreated": |
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.
Do we not need to handle NewEpoch?
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.
Cool that you've realized that there was this NewEpoch
event! Right now we are not going to use it, as the new epoch will be handled by the EboProcessor
so let me delete it from the events.
break; | ||
|
||
default: | ||
throw new UnknownEvent(event.name); |
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.
if EboEventName can be something other than the few specified in type EboEventName I'm wondering if we'd need to have a 'string' option in the type and log the event without trying to access event.name 🤔
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.
A handled event must be one of the listed events.
This is more of an explicitness + maintainability thingy, as we want to force anyone who wants to support a new event to include the new event handler here. Without the default: throw
case this would be run silently while there's probably something wrong upstream with the event fetching logic (ie including unsupported events).
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.
LGTM 🍰
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.
sweet
🤖 Linear
Closes GRT-153
Description
onNewEvent
toonLastEvent
(seems more accurate)shouldHandleEvent
function to reflect its actual name lol