Right now SteemSQL has some issues with performances because of the blockchain size and speed (today Steemit has the biggest number of transactions per day). UPDATE: sorry, it is incorrect, see the arcange's comment.
The result is that SteemSQL sometimes has lagged — for example, right now (when I am writing this post) the delay is 228 minutes. And the lack of information about the delay is a problem for some users.
So I updated SteemSQL Wrapper — now you can get the info about the delay from API.
Example:
curl https://sql.steemhelpers.com/delay
{"delay_seconds": 12018}
The homepage also updated and you can check the delay right on it.
How this works
- Firstly, I get the creation date of the last block from SteemSQL
SELECT TOP 1 timestamp FROM Blocks ORDER BY block_num DESC
- Secondly, I get the creation date of the last block from the blockchain.
blockchain = steem.blockchain.Blockchain()
steemd = steem.steemd.Steemd()
current_block_num = blockchain.get_current_block_num()
current_block = steemd.get_block_header(current_block_num)
blockchain_last_date = datetime.strptime(current_block['timestamp'], "%Y-%m-%dT%H:%M:%S")
- Thirdly, I compare these two dates.
delay = blockchain_last_date - steemsql_last_date
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
I could remember your previous contributions, so I knew you were working on this project. But to make the work easier for other mods, please add a screenshot next time which shows you logged in to GitHub as proof of work, because you have a different username here on Utopian.
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @vladimir-simovic, thanks!
I actually added this proof, see the last image :)
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Lag was not because of blockchain size or speed, but performance of the steemd node use to retrieve blocks.
You don't need to use WHERE clause.
The fastest way to retrieve the last block timestamp is:
SELECT TOP 1 timestamp FROM Blocks ORDER BY block_num DESC
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Oh, thanks, updated the post and fixed the SQL.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I didn't know there was a possibility of such a long delay. That's useful to know for my analyses.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @emptyname! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @emptyname I am @utopian-io. I have just upvoted you!
Achievements
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit