-
Notifications
You must be signed in to change notification settings - Fork 213
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
Connect Pool DB with Api #881
Conversation
1337b43
to
6c15d00
Compare
6c15d00
to
fd70b03
Compare
6a961e5
to
2b98247
Compare
|
||
-- StakePool | ||
PoolSqlite.withDBLayer cfg tr (poolDBPath databaseDir) $ | ||
\splDB -> do |
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.
why the line-break here 😬 ?
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.
Because we have a rule saying lines must be 80 characters or less 😬 This one would have been 81.
Maybe importing Cardano.Pool.DB.Sqlite
as Pool
instead of PoolSqlite
would actually be nice though…
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.
Hmm. Yes. But the guidelines are... Guidelines. When it makes sense, we can break them and we sometimes do.
5294f42
to
91fcdaa
Compare
_ -> return Nothing | ||
|
||
progress :: BlockHeader -> BlockHeader -> Percentage | ||
progress tip target = |
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.
Why not use the progress calculation from the primitive types?
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.
- This
blockHeight
-calculation would return 100% when we are at the node tip. I.e. when thestake-pool list
results become available.syncProgress
compare to the current time. If the node tip is behind the current time, the progress might then jump from 50% to, show results. - This
blockHeight
approach is simple and gives us (seemingly) perfectly linear increase in progress. syncProgress
returnsSyncProgress = Ready | Restoring
, which we don't want.syncProgress
has atolerance
which we don't want. Here we know that we are not in sync, and want to show the exact progress to the user. Even if that would happen to be 99% or 100%.
PoolSqlite.withDBLayer cfg tr (poolDBPath databaseDir) $ | ||
\splDB -> do | ||
|
||
-- TODO: I believe @KTorZ wants us to use @WorkerRegistry@ |
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.
Not WorkerRegistry
. There's no need for this. But newWorker
would be good. With void $ forkIO
, we are just firing a thread in the wild and we have no control over it..
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.
Separate PR? And can we talk about it first or maybe you want to do do that?
1d524da
to
44741c3
Compare
f3136c4
to
a5e657f
Compare
bors r+ |
881: Connect Pool DB with Api r=Anviking a=Anviking # Issue Number #713 # Overview - [x] I have implemented a `GET /stake-pool` that reads and combines metrics from `Pool.DB` - [x] TODO: Figure out when we are unsynced - [ ] TODO: Look for things to test if possible in this PR # Comments ### Self-node with a very short epoch-length (results are unavailable across epoch boundaries) ![self-node-short-epochs](https://user-images.githubusercontent.com/304423/67398367-d0edc680-f5aa-11e9-86da-ac13337e2a63.gif) ### Testnet syncing which is interrupted and resumed ![testnet-2](https://user-images.githubusercontent.com/304423/67399072-f7f8c800-f5ab-11e9-9fb1-38e8886aeba4.gif) <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io> Co-authored-by: KtorZ <matthias.benkort@gmail.com>
Build failed |
4540a00
to
247270c
Compare
bors r+ |
881: Connect Pool DB with Api r=KtorZ a=Anviking # Issue Number #713 # Overview - [x] I have implemented a `GET /stake-pool` that reads and combines metrics from `Pool.DB` - [x] TODO: Figure out when we are unsynced - [ ] TODO: Look for things to test if possible in this PR # Comments ### Self-node with a very short epoch-length (results are unavailable across epoch boundaries) ![self-node-short-epochs](https://user-images.githubusercontent.com/304423/67398367-d0edc680-f5aa-11e9-86da-ac13337e2a63.gif) ### Testnet syncing which is interrupted and resumed ![testnet-2](https://user-images.githubusercontent.com/304423/67399072-f7f8c800-f5ab-11e9-9fb1-38e8886aeba4.gif) <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io> Co-authored-by: KtorZ <matthias.benkort@gmail.com>
Build failed |
fixup: use minBound :: Percentage fixup: convert -> count fixup whitespace spl Add more detailed TODOs for detecting if we are unsynced Fixup: accidental diff Other approach
fixup: f -> mkApiStakePool fixup: error in bridge listStakePools fixup: use withDBLayer Other approach
…assertions NOTE: 4xx code are for CLIENTS errors. Not being able to answer because we aren't synced is not a client error.
…ackoff in 'nextBlocks' too
247270c
to
3adffb1
Compare
bors r+ |
881: Connect Pool DB with Api r=KtorZ a=Anviking # Issue Number #713 # Overview - [x] I have implemented a `GET /stake-pool` that reads and combines metrics from `Pool.DB` - [x] TODO: Figure out when we are unsynced - [ ] TODO: Look for things to test if possible in this PR # Comments ### Self-node with a very short epoch-length (results are unavailable across epoch boundaries) ![self-node-short-epochs](https://user-images.githubusercontent.com/304423/67398367-d0edc680-f5aa-11e9-86da-ac13337e2a63.gif) ### Testnet syncing which is interrupted and resumed ![testnet-2](https://user-images.githubusercontent.com/304423/67399072-f7f8c800-f5ab-11e9-9fb1-38e8886aeba4.gif) <!-- Additional comments or screenshots to attach if any --> <!-- Don't forget to: ✓ Self-review your changes to make sure nothing unexpected slipped through ✓ Assign yourself to the PR ✓ Assign one or several reviewer(s) ✓ Once created, link this PR to its corresponding ticket ✓ Acknowledge any changes required to the Wiki --> Co-authored-by: Johannes Lund <johannes.lund@iohk.io> Co-authored-by: KtorZ <matthias.benkort@gmail.com>
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.
Nice work!
Build succeeded |
\situation. Here's some information about what happened: \n" | ||
o `shouldBe` mempty | ||
c `shouldBe` ExitFailure 1 | ||
eventually $ do |
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 was wondering if there was something as simple as eventually
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.
:man-shrugging:
Issue Number
#713
Overview
GET /stake-pool
that reads and combines metrics fromPool.DB
Comments
Self-node with a very short epoch-length (results are unavailable across epoch boundaries)
Testnet syncing which is interrupted and resumed