197 def reset_caches(self): |
197 def reset_caches(self): |
198 """method called during test to reset potential source caches""" |
198 """method called during test to reset potential source caches""" |
199 self._cache = {} |
199 self._cache = {} |
200 self._query_cache = TimedCache(self._cache_ttl) |
200 self._query_cache = TimedCache(self._cache_ttl) |
201 |
201 |
202 def init(self): |
202 def init(self, activated, session=None): |
203 """method called by the repository once ready to handle request""" |
203 """method called by the repository once ready to handle request""" |
204 self.info('ldap init') |
204 if activated: |
205 # set minimum period of 5min 1s (the additional second is to minimize |
205 self.info('ldap init') |
206 # resonnance effet) |
206 # set minimum period of 5min 1s (the additional second is to |
207 self.repo.looping_task(max(301, self._interval), self.synchronize) |
207 # minimize resonnance effet) |
208 self.repo.looping_task(self._cache_ttl // 10, |
208 self.repo.looping_task(max(301, self._interval), self.synchronize) |
209 self._query_cache.clear_expired) |
209 self.repo.looping_task(self._cache_ttl // 10, |
|
210 self._query_cache.clear_expired) |
210 |
211 |
211 def synchronize(self): |
212 def synchronize(self): |
212 """synchronize content known by this repository with content in the |
213 """synchronize content known by this repository with content in the |
213 external repository |
214 external repository |
214 """ |
215 """ |