Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 769

Show
Ignore:
Timestamp:
10/31/05 13:06:40
Author:
fumanchu
Message:

Fix for #308 (configure autoreload's poll rate).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpserver.py

    r768 r769  
    6464            if conf('autoreload.on', False): 
    6565                try: 
    66                     autoreload.main(self._start) 
     66                    freq = conf('autoreload.frequency', 1) 
     67                    autoreload.main(self._start, freq) 
    6768                except KeyboardInterrupt: 
    6869                    cherrypy.log("<Ctrl-C> hit: shutting down autoreloader", "HTTP") 
  • trunk/cherrypy/lib/autoreload.py

    r762 r769  
    99RUN_RELOADER = True 
    1010reloadFiles = [] 
    11      
    12 def reloader_thread(): 
     11 
     12def reloader_thread(freq): 
    1313    mtimes = {} 
    1414     
     
    3030                if mtime > mtimes[filename]: 
    3131                    sys.exit(3) # force reload 
    32         time.sleep(1
     32        time.sleep(freq
    3333 
    3434def restart_with_reloader(): 
     
    4343            return exit_code 
    4444 
    45 def main(main_func, args=None, kwargs=None): 
     45def main(main_func, args=None, kwargs=None, freq=1): 
    4646    if os.environ.get("RUN_MAIN") == "true": 
    4747         
     
    5454        # If KeyboardInterrupt is raised within reloader_thread, 
    5555        # let it propagate out to the caller. 
    56         reloader_thread(
     56        reloader_thread(freq
    5757    else: 
    5858        # If KeyboardInterrupt is raised within restart_with_reloader, 

Hosted by WebFaction

Log in as guest/cpguest to create tickets