Handling trade offer accept responses
You might have seen this already. You accept a trade offer, you get an error (i.e. code 42), but the items are traded and the trade offer goes through.
Current trade offer branch by @StormReaper returns bool when accepting (+ tradeid via out), but almost every single large trade offer fails with some sort of cryptic error code.
Accept method should provide these error messages, so we know what to do, e.g.:
- code 42 - retry accept
- code 11 - retry accept
- code 24 - cookies are broken, don't bother retrying ...
- etc.
Or perhaps it should just retry on its own, and return a failure if it doesn't work after a few attempts?
Regardless, though this is a big issue, I still think we should merge what we have, given how many people are already using it, and how big of a change it is (it's preventing me from starting another big project).
Well that is an option too, but how do we decide how many attemps? I would rather let the programmer choose what to do.
Large trade offers will always fail though. Good thing is, @StormReaper already implemented check for this.
Regarding retries in general, what do you think about retrying after 1 second, then 2, then 4, then 8, etc., instead of a fixed delay? (i.e. 2^0,1,2,3...)
I've noticed sometimes when a bot has issues logging in, it retries every 2 seconds many times before it is successful, which seems excessive.
If accepting failed we can just check offer status after 10 sec. If it still active - accept again, if it accepted - all good, if it canceled or have invalid items - do nothing.
My record - 38 attempts to accept. Offer accepted successfully only after 38 attempts.