Roxen.git / server / base_server / roxen.pike

version» Context lines:

Roxen.git/server/base_server/roxen.pike:1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS.   //   // The Roxen WebServer main program.   //   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.1126 2012/12/12 15:03:39 grubba Exp $"; + constant cvs_version="$Id$";      //! @appears roxen   //!   //! The Roxen WebServer main program.      // The argument cache. Used by the image cache.   ArgCache argcache;      // Some headerfiles   #define IN_ROXEN
Roxen.git/server/base_server/roxen.pike:4380:    error("Expected mapping as the first element of the argument array\n");    update_args( data[0] );    ci = map( map( data, tomapp ), argcache->store, timeout )*"$";    } else    ci = data;    update_args = 0; // To avoid garbage.       if( zero_type( uid_cache[ ci ] ) )    {    uid_cache[ci] = user; -  if( catch(QUERY("INSERT INTO "+name+" " -  "(id,uid,atime) VALUES (%s,%s,UNIX_TIMESTAMP())", -  ci, user||"")) ) -  QUERY( "UPDATE "+name+" SET uid=%s WHERE id=%s", -  user||"", ci ); +  // Make sure to only update the entry if it does not already +  // exists or has wrong uid. Allways updating the table will +  // casue mysql to lock the table and cause a potential gobal +  // ImageCache stall. +  string uid = user || ""; +  array q = QUERY("SELECT uid from "+name+" where id=%s", ci); +  if(!sizeof(q) || (sizeof(q) && q[0]->uid != uid)) { +  QUERY("INSERT INTO "+name+" " +  "(id,uid,atime) VALUES (%s,%s,UNIX_TIMESTAMP()) " +  "ON DUPLICATE KEY UPDATE uid=%s", +  ci, uid, uid);    } -  +  }      #ifndef NO_ARG_CACHE_SB_REPLICATE    if(id->misc->persistent_cache_crawler || id->misc->do_replicate_argcache) {    // Force an update of rep_time for the requested arg cache id.    foreach(ci/"$", string key) {   #if ARGCACHE_DEBUG    werror("Request for id %O from prefetch crawler.\n", key);   #endif /* ARGCACHE_DEBUG */    argcache->refresh_arg(key);    }