Every once in a while I get a badtoken exception. This is probably because I have multiple bots running on the same site at the same time (race condition).
- Bot A requests token -> 123
- Bot B requests token -> 123
- Bot A edits with token 123 -> ok
- Bot B edits with token 123 -> poof
We could of course implement very difficult synchronization, but it doesn't happen very often so it's probably better handle it like a collision in ethernet.
- Detect the badtoken
- Back off for a random number of seconds
- Get a new token
- Do the edit
Max tries should be respected so the bot can't get into a infinite retry loop.