https://bugzilla.wikimedia.org/show_bug.cgi?id=59678
Web browser: --- Bug ID: 59678 Summary: Implement badtoken detection and recovery Product: Pywikibot Version: core (2.0) Hardware: All OS: All Status: NEW Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: maarten@mdammers.nl Classification: Unclassified Mobile Platform: ---
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.