Roxen.git / server / modules / misc / periodic-fetcher.pike

version» Context lines:

Roxen.git/server/modules/misc/periodic-fetcher.pike:1:   // This is a roxen module. Copyright © 2012, Roxen IS.      #include <module.h>   inherit "module";    - constant cvs_version = "$Id: periodic-fetcher.pike,v 1.1 2012/01/23 15:54:53 wellhard Exp $"; + constant cvs_version = "$Id: periodic-fetcher.pike,v 1.2 2012/05/10 05:53:49 liin Exp $";   constant thread_safe = 1;   constant module_type = MODULE_ZERO;      LocaleString module_name = "Periodic Fetcher";   LocaleString module_doc =   #"<p>The module fetches a list of URLs periodically. The periodicity can   be specified per URL. The main purpose is to populate caches and keep   them warm. </p>      <p>The list of URLs is specified in a file in the site itself. This
Roxen.git/server/modules/misc/periodic-fetcher.pike:168:   void ready_to_receive_requests()   {    event_queue = ADT.Priority_queue();       if(!query("enable"))    {    crawler_status = "<b>Crawler disabled</b>";    return;    }    +  roxen.background_run(1, init_crawler); + } +  + void init_crawler() {    array(Event) events = fetch_events(query("crawl_src"));    if(!events)    {    return;    }       // Populate queue    foreach(events, Event event)    schedule_event(event);