-
Notifications
You must be signed in to change notification settings - Fork 45
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: functions to convert unix epoch to fil epoch #252
Conversation
- adds `unix_to_height` and `height_and_unix` to translate a unix epoch in seconds to a fil epoch This is mainnet specific, so this may not be the right approach. I'd need to be able to programmatically set the initial unix epoch time to suport other networks License: MIT Signed-off-by: Oli Evans <[email protected]>
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.
Good Stuff!
`) | ||
|
||
down := batch(` | ||
DROP FUNCTION IF EXISTS public.actor_tips; |
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.
Should this be
DROP FUNCTION IF EXISTS public.unix_to_height
DROP FUNCTION IF EXISTS public.height_to_unix
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 very very should
- the downs. they were wrong. now they down good. License: MIT Signed-off-by: Oli Evans <[email protected]>
License: MIT Signed-off-by: Oli Evans <[email protected]>
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 but it needs to be changed to migration 20 now
other migrations have landed in the meantime. License: MIT Signed-off-by: Oli Evans <[email protected]>
Updated to be migration 21. What's the etiquette round here? This seems innocuous and helpful... I'm ok with them being hardcodded for mainnet only for now. If we made them select the info from a table at runtime, they would be slower, but work for every network... perhaps visor could provide the genesis info to the template at migration time? That sounds more complicated, but seems optimal for perf. I have no numbers on the perf impact of selecting the genesis info at rumtime, but we want to be able to run this function on every row returned, to convert the height to a time that can be passed to grafana, so I'd assume it'd be worth hardcoding it if we can. I'm going to deploy the functions manually on the analysis and montoring db today, as they are mainnet specific already, unless anyone objects. |
Happy for you to merge when ready |
adds
unix_to_height
andheight_and_unix
to translate a unix epoch in seconds to a fil epoch. Makes searching the messages tables more fun.This is mainnet specific, so this may not be the right approach. I'd need to be able to programmatically set the initial unix epoch time to suport other networks.
License: MIT
Signed-off-by: Oli Evans [email protected]