Klaus Demo klaus / 6798f9b
Rename variable Jonas Haag 2 months ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2525 old_contents = glob.glob(glob_pattern)
2626 while 1:
2727 time.sleep(interval)
28 if _.should_reload:
28 if S.should_reload:
2929 # klaus application has not seen our change yet
3030 continue
3131 new_contents = glob.glob(glob_pattern)
3232 if new_contents != old_contents:
3333 # Directory contents changed => should_reload
3434 old_contents = new_contents
35 _.should_reload = True
35 S.should_reload = True
3636
3737
3838 def make_autoreloading_app(repos_root, *args, **kwargs):
3939 def app(environ, start_response):
40 if _.should_reload:
40 if S.should_reload:
4141 # Refresh inner application with new repo list
4242 print("Reloading repository list...")
43 _.inner_app = make_app(glob.glob(repos_root + '/*'), *args, **kwargs)
44 _.should_reload = False
45 return _.inner_app(environ, start_response)
43 S.inner_app = make_app(glob.glob(repos_root + '/*'), *args, **kwargs)
44 S.should_reload = False
45 return S.inner_app(environ, start_response)
4646
4747 # Background thread that polls the directory for changes
4848 poller_thread = threading.Thread(target=(lambda: poll_for_changes(10, repos_root)))