server/sources/ldapuser.py
branchstable
changeset 5646 c9550c1239f0
parent 5642 6a90357b9769
child 5789 0f969e5c579a
equal deleted inserted replaced
5644:73d8a757db80 5646:c9550c1239f0
   189         self._cache = {}
   189         self._cache = {}
   190         # ttlm is in minutes!
   190         # ttlm is in minutes!
   191         self._cache_ttl = time_validator(None, None,
   191         self._cache_ttl = time_validator(None, None,
   192                               source_config.get('cache-life-time', 2*60*60))
   192                               source_config.get('cache-life-time', 2*60*60))
   193         self._cache_ttl = max(71, self._cache_ttl)
   193         self._cache_ttl = max(71, self._cache_ttl)
   194         self._query_cache = TimedCache(self.cache_ttl)
   194         self._query_cache = TimedCache(self._cache_ttl)
   195         # interval is in seconds !
   195         # interval is in seconds !
   196         self._interval = time_validator(None, None,
   196         self._interval = time_validator(None, None,
   197                                     source_config.get('synchronization-interval',
   197                                     source_config.get('synchronization-interval',
   198                                                       24*60*60))
   198                                                       24*60*60))
   199 
   199 
   206         """method called by the repository once ready to handle request"""
   206         """method called by the repository once ready to handle request"""
   207         self.info('ldap init')
   207         self.info('ldap init')
   208         # set minimum period of 5min 1s (the additional second is to minimize
   208         # set minimum period of 5min 1s (the additional second is to minimize
   209         # resonnance effet)
   209         # resonnance effet)
   210         self.repo.looping_task(max(301, self._interval), self.synchronize)
   210         self.repo.looping_task(max(301, self._interval), self.synchronize)
   211         self.repo.looping_task(self.cache_ttl // 10,
   211         self.repo.looping_task(self._cache_ttl // 10,
   212                                self._query_cache.clear_expired)
   212                                self._query_cache.clear_expired)
   213 
   213 
   214     def synchronize(self):
   214     def synchronize(self):
   215         """synchronize content known by this repository with content in the
   215         """synchronize content known by this repository with content in the
   216         external repository
   216         external repository