HLS tool update - know your pending comment author rewards ( along with post author rewards )
Good evening to everyone , I hope you all are doing good .
I just updated my HLS tool today to update an existing feature .
Post Author rewards
Couple of months ago I added this feature of "Know your pending Post author rewards " .
What it basically did is , it took all your posts in past 7 days and calculated the second layer token rewards for those posts .
It was well received by users because
- There aren't many places right now ( Except this tool and Marky's tool ) where you can see all second layer token rewards at the same place .
- We use multiple tags on most of our posts and we would like to know all tokens earned on a particular post at one place.
Comment Author rewards
But there was something missing , the comment rewards , right now there isn't any app which tells you the second layer token rewards at the same place for both comments and posts - I didn't add this to the script back then because it just took way too much time to retrieve the info .
Amount of time taken initially
So it followed the same procedure as post author rewards .
-
Retrieve all the comments made by your account in past 7 days ( pending payouts ) .
-
Calculate the second layer tokens rewards for each comment .
-
Convert those second layer token rewards to Hive ( for each comment )
-
Add everything and display the summary .
So at first when I did this , I tried with a particular username who had posted 1000 comments and it took my on an average 67 minutes to retrieve these .
Filters added
Then I started working on reducing the amount of time taken because 67 minutes is just ridiculous .
1st filter -
So the first filter that I added was to remove the comments / posts for which there were 0 upvotes .
Obviously if 0 upvotes then 0 earnings , don't even have to check how many tokens you are eligible to gain .
This reduced the time taken considerably . If an user made 1000 comments then on an average 400 comments are upvoted ( I just calculated this for 15 users so it might not be accurate ), it took 20 minutes now instead of 67 minutes .
But still that isn't enough , 20 minutes is huge too .
2nd filter
This was a game changer and I was kinda stupid to have overlooked this .
Initially for each and every comment there was an API call made to retrieve the latest token price ( to convert it to Hive ) . This was taking way too long cumulatively speaking .
So at the start of the script itself I retrieve and store all the latest token price and then for each and every comment the same price is used .
This reduced the time taken from 20 minutes to 3 minutes .
So right now , if you have say 500 comments which are upvoted ( atleast 1 upvote ) then it will take approximately 200-250 seconds to retrieve all the data .
Well that isn't fast either - 0.5 seconds for 1 comment ?
That's true . 0.5 seconds per comment ? That's huge but believe me I have done my best , I researched and looked at all possible ways to reduce the time .
If anyone has any more ideas , I would love to hear it and implement it ASAP depending on the complexity of the solution .
Finally
Steps to get the data
-
Choose "Post rewards" in top left.
-
Now you will see 4 options -
-
1st is only for a particular URL
-
2nd is for only posts ( all pending posts )
-
3rd is for only comments ( all pending comments )
-
4th is for both pending posts and comments .
-
Here you can see the number "62" - it means that out of all your pending posts and comments there are only 62 posts/comments which got atleast 1 upvote.
And wait for it to load everything and at the end you can see the Summary -
Things to note
-
This is only for second layer tokens and not for Hive
-
The Summary contains both author and curation rewards together .
-
The convertion price to Hive is the latest token price.
I will try and improve this as and when I can . That's it for now . Will meet you tomorrow with another post .
Regards, MR.
Posted Using LeoFinance Beta