Branch: Tag:

2008-03-07

2008-03-07 13:04:50 by Martin Jonsson <marty@roxen.com>

Added the "ignore" keyword to the insert query in add_uri() to avoid a backtrace when multiple threads call add_uri() simultaneously (there's a race condition but it doesn't really matter except that we don't want a backtrace).

Rev: lib/modules/Search.pmod/Queue.pmod/MySQL.pike:1.22

108:    }    }    else -  db->query( "insert into "+table+ +  // There's a race condition between the select query in has_uri() +  // and this query, so we ignore duplicate key errors from MySQL +  // by using the "ignore" keyword. +  db->query( "insert ignore into "+table+    " (uri,uri_md5,recurse,template) values (%s,%s,%d,%s)",    string_to_utf8((string)r),    to_md5((string)r), recurse, (template||"") );