dscotese / kraken-grid

A bot that extends grid trading once you use it to create a grid.
GNU General Public License v3.0
9 stars 3 forks source link

On auto, executions stack up when too many timeouts occur. #10

Closed dscotese closed 2 years ago

dscotese commented 2 years ago

If the bot is on auto, it will try again next time anyway, so it could give up once the waiting time it uses is over half of the delay setting.

dscotese commented 2 years ago

setInterval can make multiple calls before the execution of the first call is complete. This problem is solved by having setInterval (at line 702 as of this comment) simply reduce a counter, The counter can go negative without any problem because report() is only called when counter is zero. When report() finally completes (since I just changed setInterval to call an async function so that report can be awaited), the potentially very negative counter will be reset to the delay that is suppose to occur between calls. I believe this solves another problem which I have not added as a issue because it was difficult to describe (though I wrote about it here). The change is on the Bleeding branch.