pike.git / lib / modules / Search.pmod / Utils.pmod

version» Context lines:

pike.git/lib/modules/Search.pmod/Utils.pmod:1:   // This file is part of Roxen Search   // Copyright © 2001 Roxen IS. All rights reserved.   // - // $Id: Utils.pmod,v 1.33 2001/11/22 14:48:16 js Exp $ + // $Id: Utils.pmod,v 1.34 2002/02/20 17:31:08 js Exp $      #if !constant(report_error)   #define report_error werror   #define report_debug werror   #define report_warning werror   #endif      #ifdef SEARCH_DEBUG   # define WERR(X) report_debug("search: "+(X)+"\n");   #else
pike.git/lib/modules/Search.pmod/Utils.pmod:60:    //! @decl void create(int database_profile_id, int query_profile_id,@    //! ProfileCache cache)    //! @param cache    //! The parent cache object.    void create(int _database_profile_id,    int _query_profile_id,    ProfileCache _my_cache) {    database_profile_id = _database_profile_id;    query_profile_id = _query_profile_id;    my_cache = _my_cache; -  int last_stat = time(1); +  int last_stat = time();       // Prefetch..    get_ranking();    }       //! Checks if it is time to check if the profile values are    //! to old.    int(0..1) check_timeout() { -  if(time(1)-last_stat < 5*60) return 0; -  last_stat = time(1); +  if(time()-last_stat < 5*60) return 0; +  last_stat = time();    return 1;    }       //! Returns the database profile value @[index].    mixed get_database_value(string index) {    if(!database_values)    database_values = my_cache->get_value_mapping(database_profile_id);    return database_values[index];    }   
pike.git/lib/modules/Search.pmod/Utils.pmod:293:    THROW("No query profile " + name + " found.\n");       return query_profile_names[name] = (int)res[0]->id;    }       private int last_db_prof_stat = 0; // 1970       //! Returns a list of available database profiles.    array(string) list_db_profiles() {    /* -  if (time(1) - last_db_prof_stat < 5*60) +  if (time() - last_db_prof_stat < 5*60)    return indices(db_profile_names);*/    array res = get_db()->query("SELECT name, id FROM profile WHERE type=2");    db_profile_names = mkmapping(    res->name,    map(res->id, lambda(string s) { return (int) s; } ));    if(sizeof(res)) -  last_db_prof_stat = time(1); +  last_db_prof_stat = time();    return res->name;    }       private int last_query_prof_stat = 0; // 1970       //! Returns a list of available query profiles.    array(string) list_query_profiles()    {    /* -  if (time(1) - last_query_prof_stat < 5*60) +  if (time() - last_query_prof_stat < 5*60)    return indices(query_profile_names);*/    array res = get_db()->query("SELECT name, id FROM profile WHERE type=1");    query_profile_names = mkmapping( res->name, (array(int)) res->id );    if(sizeof(query_profile_names)) -  last_query_prof_stat = time(1); +  last_query_prof_stat = time();    }       // Used when decoding text encoded pike data types.    private object compile_handler = class {    mapping(string:mixed) get_default_module() {    return ([ "aggregate_mapping":aggregate_mapping,    "aggregate_multiset":aggregate_multiset,    "aggregate":aggregate,    "allocate":allocate,    "this_program":0 ]);
pike.git/lib/modules/Search.pmod/Utils.pmod:457:    schedule();    }       //! Call this method to indicate that a new entry has been added    //! to the queue. The scheduler will delay indexing with at most    //! @[latency] minutes.    void new_entry(int latency, array(int) profiles) {    int would_be_indexed = time() + latency*60;    foreach(profiles, int profile)    crawl_queue[profile] = 0; -  WERR("New entry. time: "+(would_be_indexed-time(1))+" profiles: "+(array(string))profiles*","); -  if(next_run && next_run < would_be_indexed) +  WERR("New entry. time: "+(would_be_indexed-time())+" profiles: "+(array(string))profiles*","); +  if(next_run && next_run<would_be_indexed && next_run>=time())    return;    next_run = would_be_indexed;    reschedule();    }       private void reschedule() {    remove_call_out(do_scheduled_stuff); -  WERR("Scheduler runs next event in "+(next_run-time(1))+" seconds."); -  call_out(do_scheduled_stuff, next_run-time(1)); +  WERR("Scheduler runs next event in "+(next_run-time())+" seconds."); +  call_out(do_scheduled_stuff, next_run-time());    }       void unschedule() {    remove_call_out(do_scheduled_stuff);    }       void schedule() {    crawl_queue = ([]);    compact_queue = ([]);   
pike.git/lib/modules/Search.pmod/Utils.pmod:489:    object dbp = db_profiles[id];    if(!dbp) {    report_warning("Search database profile %d destructed.\n", id);    m_delete(db_profiles, id);    continue;    }    WERR("Scheduling for database profile "+dbp->name);    int next = dbp->next_crawl();    if(next != -1) {    crawl_queue[dbp->id] = next; -  WERR(" Crawl: "+(next-time(1))); +  WERR(" Crawl: "+(next-time()));    }    next = dbp->next_compact();    if(next != -1) {    compact_queue[dbp->id] = next; -  WERR(" Compact: "+(next-time(1))); +  WERR(" Compact: "+(next-time()));    }    WERR("\n");    }       if(!sizeof(crawl_queue) && !sizeof(compact_queue)) return;    next_run = min( @values(crawl_queue)+values(compact_queue) );    reschedule();    }       private void do_scheduled_stuff() {