dreamwidth/dw-free — pull request #236 by afuna (2013-01-25 09:11:16+00:00)
Title: (Bug 4865) Temporary fail the import if we weren't able to load a user

* fail the import with a list of users we couldn't load, if we weren't
able to load users from the remote site
* fix bug which prevented us from retrying users after they've timed out
once

Based on discussion over at dreamwidth/dw-free#198:

The error is caused by the openid user ($ou) not actually existing. The most
common reason is that we timed out while fetching data on the $ou.

We can't just let the importer continue in this case, because that would make
the comment be posted (wrongly) as by an anonymous user. So we've decided to
make the import temp-fail with the list of users we failed on. We can pick it
up again on a retry.

Problem again: subtle bug meant that once we failed to fetch a particular
user, we never again retried. If it timed out, we returned
(and stored in the db) 0, instead of NULL. Later on, when retrieving the
values, we check for defined-ness. Fix is to set an explicit return undef for
the future. For existing cases, we check for truth value of
$oid, instead of defined-ness. (This also means that we finally log data on
this user if something goes wrong)

Note that the temp-fail listed above means that a problem user which we
somehow never fetch, could still cause all imports where they commented to
fail entirely. But now we know who they are, and we have a working retry
mechanism in place to guard against timeouts.

*If* the retries don't work for some unforeseen reason, we have something to
work with once the repeated failure to import has been reported.

Ping @xb95!