-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fix casting db type as nullable rather than optional #474
Conversation
@as("first_event_block_number") firstEventBlockNumber: option<int>, | ||
@as("latest_processed_block") latestProcessedBlock: option<int>, | ||
@as("num_events_processed") numEventsProcessed: option<int>, | ||
@as("end_block") endBlock: Js.Nullable.t<int>, |
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.
Shouldn't it be Js.Null.t instead?
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 could be but I didn't test, just based on the error message so I'm worried if it's possible to get undefined as well 😅
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.
Happy to use Js.Null.t though if I'm being silly
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.
I think it's fine. But I'd like to ask to leave a comment that it's probably Null and we use Nullable only because we didn't confirm it yet. So in the future we don't have hard assumptions that there's an undefined incoming
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.
@DZakh done 🙏🏼
Unfortunately the bug was an indexer casting
latest_processed_block
to option type when it was nullable.It then failed the switch case on option and called the prometheus gauge function with a null value.