Closed emmanueldenloye closed 1 year ago
Thank you for this PR @emmanueldenloye, I see that this PR made things conceptually simpler, so I've asked a few changes to move it even further in this simplicity.
Also, would you mind making a request to the stats endpoint after this PR and share its response, timing information and the database query that gets executed.
I think I've taken into account all of your criticisms. Here is how fast it takes for the stats endpoint to return.
[emmanuel@nixos:~]$ time curl -XGET "http://18.206.81.105:8080/stats"
{"transactionCount":7413320,"coinsInCirculation":2.29262750345e8}
real 0m0.115s
user 0m0.005s
sys 0m0.005s
Also, here are the queries that were executed to produce this information.
2023-05-11T17:58:30.080Z [Debug] [] SELECT reltuples::bigint AS estimate FROM pg_class WHERE oid='transactions'::regclass::oid
2023-05-11T17:58:30.098Z [Debug] [] SELECT MAX("t0"."height") AS "res0" FROM "blocks" AS "t0"
@emmanueldenloye thanks for the changes and also for posting the queries! I think this PR is very close to completion; We just have that minor bump with the logs I've mentioned above.
The db should be handling this state and not an IORef.