I worked on decreasing the delay of scotbot and finally I achieved some good results. The delay could be reduced from 50 seconds (somethings it was even 10-15 minutes) around 15 seconds.
Sending (transfer/issue) out claimed token is done in a separate loop now
The problem with sending token is that broadcasting a custom_json needs around 1-2 seconds and when the same token should be send to two different accounts, the delay is 3 seconds (only one custom_json in a block).
I improved this bottleneck by
- Whenever a
scot_claim_tokencustom_json is bradcasted, a new entry is generated in the internal database
- The pending token are checked and transfered/issue in a seperate loop which does not block scotbot anymore
- The blockchain is scanned if the operation is broadcasted to the STEEM blockchain
- When a custom_json is not broadcasted (Due to low RC for example), it is flagged for manually review.
During implementing this, I build in a bug, which allows it to claim the same amount of token several times (only for scot token which transfer token). The bug is fixed by now.
I improved also the way how it is checked if a custom_json was correctly broadcasted.
Streaming of stake and delegate operation
Reading the wallet of all scot user took some seconds which has blocked scotbot in the past.
custom_json which are related to staking token and delegating them are now continuously parsed. Whenever a user increase the amount of staked token, scotbot will parse the custom_json and adapt the value in the database.
From time to time the token amount of all scot user is read from the steem-engine again, but this can be done less frequent than before which reduces the lag of scotbot.
I can view the entry in the scotbot database by http://scot-api.steem-engine.com/@holger80?token=LEO :
A few seconds after staking the 0.724 LEO, scotbot has updated its database (the amount is stored as integer):
The time delay between broadcasting votes and comments and showing them on a tribe website could be strongly reduced. It should be below 15 seconds right now.