drallieiv/KinanCity

Utility should stop when 2captcha balance starts reporting $0

tomballgithub opened this issue · 4 comments

Saw this yesterday when balance ran out. It just does this infinitely although that doesn't really harm anything. It really should exit gracefully

07-03 23:43:10 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:10 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha
07-03 23:43:11 [2captcha] KO response when sending IN 2captcha : {"status":0,"request":"ERROR_ZERO_BALANCE"}
07-03 23:43:11 [2captcha] Request new Captcha

I disagree : It should be less agressive and trigger just a pause, but it should not stop the process.
If you add balance to it, it should make progress again.

It could be a good idea to stop the process, but they are designed to be unlinked between the thread providing the captchas and the worker thread waiting to be given a captcha. They currently are not expecting any other signal then being given a captcha to use.

Without changing the worker, at best we can stop the 2captcha thread, but there are no input that can be used to start it again.

With the server based app, that would be possible, but the command line usage does not allow interactions once it is started.

My recommendation would be to exit. I suspect most people would not expect the utility to restart gracefully by adding more $. That all said, it really doesn't hurt anything as is so I am OK with however you want to deal with this.

I got my IP banned by 2captcha when I left Kinan spamming them with requests for, like, 12 hours or so. I also believe it is safer to just exit on zero balance.

Though it would be nice to analyze 2captcha funds at the start of the job and throw a warning if there is likely to be insufficient $$$ for the requested amount of accounts. I know it is hard to say for sure, since 2captcha prices and success rates vary from time to time, but +-20% estimate is also better than nothing.

okay @drugol i'll move that to priority, but I also first need to implement the required timings as described in :

https://2captcha.com/api-2captcha#limits

But that could be tricky if at one point several of your threads are using the same IP

The warning thingy at startup if low funds (message + few seconds timer) is a good idea.