]>
git.ipfire.org Git - ipfire.org.git/blob - src/scripts/ipfire.org.in
7 import webapp
.backend
as backend
13 self
.ioloop
.set_blocking_log_threshold(900)
15 self
.backend
= backend
.Backend("webapp.conf")
19 return tornado
.ioloop
.IOLoop
.instance()
21 def add(self
, manager_cls
):
22 manager
= manager_cls(self
)
23 self
._managers
.append(manager
)
29 for manager
in self
._managers
:
38 class Manager(object):
39 def __init__(self
, daemon
):
42 self
.pc
= tornado
.ioloop
.PeriodicCallback(self
, self
.timeout
* 1000)
44 logging
.info("%s was initialized." % self
.__class
__.__name
__)
49 logging
.info("%s main method was called." % self
.__class
__.__name
__)
53 # Update callback_time.
54 self
.pc
.callback_time
= self
.timeout
* 1000
55 logging
.debug("Next call will be in %.2f seconds." % \
56 (self
.pc
.callback_time
/ 1000))
60 return self
.daemon
.backend
64 return self
.backend
.settings
69 Return a new callback timeout in seconds.
71 raise NotImplementedError
74 raise NotImplementedError
78 class MirrorManager(Manager
):
81 return self
.backend
.mirrors
85 return self
.backend
.settings
.get_int("mirror_check_interval", 3600)
88 # Check status of all mirror servers.
89 self
.mirrors
.check_all()
92 class ReleaseFilesManager(Manager
):
95 return self
.backend
.releases
99 return self
.settings
.get_int("releasefiles_check_interval", 3600)
102 for release
in self
.releases
._get
_all
():
106 if __name__
== "__main__":
109 d
.add(ReleaseFilesManager
)