wsgi.py (glance-20.0.0) | : | wsgi.py (glance-20.0.1) | ||
---|---|---|---|---|
skipping to change at line 60 | skipping to change at line 60 | |||
import webob.dec | import webob.dec | |||
import webob.exc | import webob.exc | |||
from webob import multidict | from webob import multidict | |||
from glance.common import config | from glance.common import config | |||
from glance.common import exception | from glance.common import exception | |||
from glance.common import store_utils | from glance.common import store_utils | |||
from glance.common import utils | from glance.common import utils | |||
from glance import i18n | from glance import i18n | |||
from glance.i18n import _, _LE, _LI, _LW | from glance.i18n import _, _LE, _LI, _LW | |||
from glance.image_cache import prefetcher | ||||
bind_opts = [ | bind_opts = [ | |||
cfg.HostAddressOpt('bind_host', | cfg.HostAddressOpt('bind_host', | |||
default='0.0.0.0', | default='0.0.0.0', | |||
help=_(""" | help=_(""" | |||
IP address to bind the glance servers to. | IP address to bind the glance servers to. | |||
Provide an IP address to bind the glance server to. The default | Provide an IP address to bind the glance server to. The default | |||
value is ``0.0.0.0``. | value is ``0.0.0.0``. | |||
skipping to change at line 442 | skipping to change at line 441 | |||
self._logger = logging.getLogger("eventlet.wsgi.server") | self._logger = logging.getLogger("eventlet.wsgi.server") | |||
self.threads = threads | self.threads = threads | |||
self.children = set() | self.children = set() | |||
self.stale_children = set() | self.stale_children = set() | |||
self.running = True | self.running = True | |||
# NOTE(abhishek): Allows us to only re-initialize glance_store when | # NOTE(abhishek): Allows us to only re-initialize glance_store when | |||
# the API's configuration reloads. | # the API's configuration reloads. | |||
self.initialize_glance_store = initialize_glance_store | self.initialize_glance_store = initialize_glance_store | |||
self.initialize_prefetcher = initialize_prefetcher | self.initialize_prefetcher = initialize_prefetcher | |||
if self.initialize_prefetcher: | if self.initialize_prefetcher: | |||
# NOTE(abhishekk): Importing the prefetcher just in time to avoid | ||||
# import loop during initialization | ||||
from glance.image_cache import prefetcher # noqa | ||||
self.prefetcher = prefetcher.Prefetcher() | self.prefetcher = prefetcher.Prefetcher() | |||
def cache_images(self): | def cache_images(self): | |||
# After every 'cache_prefetcher_interval' this call will run and fetch | # After every 'cache_prefetcher_interval' this call will run and fetch | |||
# all queued images into cache if there are any | # all queued images into cache if there are any | |||
cache_thread = threading.Timer(CONF.cache_prefetcher_interval, | cache_thread = threading.Timer(CONF.cache_prefetcher_interval, | |||
self.cache_images) | self.cache_images) | |||
cache_thread.daemon = True | cache_thread.daemon = True | |||
cache_thread.start() | cache_thread.start() | |||
self.prefetcher.run() | self.prefetcher.run() | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added |