Currently, we throw watchdog errors in cases where no actual error exists. We need to re-implement what mollom() does with regard to returned error codes, or perhaps even think about whether we can re-use mollom() somehow.

Comments

sun’s picture

Status: Active » Needs review
StatusFileSize
new2.48 KB

This is how I think it should work. mollom() already handles everything. Of course, the recursion is ugly, but I think it avoids to duplicate a lot of code and we get the identical fallback server handling for mollom.getServerList in the end.

dries’s picture

Here is an alternative -- not tested, just prototype code but I think it might work.

The advantage is that is keeps mollom() clean. mollom() is already quite complex and the proposed patch in #1 makes it even harder to grok.

sun’s picture

StatusFileSize
new2.41 KB

It is not really the error code that should make a difference. If we do not want to go with recursive mollom() attempt, then we'd have to do it like in attached patch. I hope the code comments explain it.

Status: Needs review » Needs work

The last submitted patch, mollom-HEAD.getServerList.3.patch, failed testing.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new2.56 KB

d'oh. ;)

Status: Needs review » Needs work

The last submitted patch, mollom-HEAD.getServerList.5.patch, failed testing.

dries’s picture

+++ mollom.inc	13 Sep 2010 18:09:53 -0000
@@ -68,24 +68,49 @@ function _mollom_authentication($public_
+    // The mollom.getServerList call can only have one valid error condition:
+    // MOLLOM_REDIRECT, directing us to try the next server in the list. All
+    // other errors are either invalid in this context (i.e., MOLLOM_REFRESH),
+    // or real errors (e.g., invalid API keys).
+    if ($result === FALSE && ($error = xmlrpc_error())) {

If we get a MOLLOM_REFRESH it is better to move to the next server instead of aborting, IMO.

+++ mollom.inc	13 Sep 2010 18:09:53 -0000
@@ -68,24 +68,49 @@ function _mollom_authentication($public_
+      // Any other error is a hard error and we need to stop trying.
+      else {
+        $messages[] = array(
+          'Error @errno from %server for %method: %message' => array(
+            '@errno' => $error->code,
+            '%server' => $server,
+            '%method' => $method,
+            '%message' => $error->message,
+          ),
+        );
+        break;
+      }

If we get an error, we need to try the next server in the list. The error might be a network error (i.e. timeout because the server is down) so we should try the next server.

sun’s picture

Status: Needs work » Needs review
StatusFileSize
new2.63 KB

Perhaps this makes us happy? :)

dries’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)

Certainly makes me happy. :)

Committed to CVS HEAD.

sun’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new2.61 KB

Same for D6, will test manually.

sun’s picture

Status: Needs review » Fixed

Thanks for reporting, reviewing, and testing! Committed to D6.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 7184764 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #909474 by sun, Dries: improved _mollom_retrieve_server_list()...

  • Commit 7184764 on master, fai6, 8.x-2.x, fbajs, actions by Dries:
    - Patch #909474 by sun, Dries: improved _mollom_retrieve_server_list()...