equal
deleted
inserted
replaced
99 # Cache iteration is based on LRU. |
99 # Cache iteration is based on LRU. |
100 for pack in self._lrucache: |
100 for pack in self._lrucache: |
101 self._lastpack = pack |
101 self._lastpack = pack |
102 yield pack |
102 yield pack |
103 |
103 |
104 cachedpacks = set(pack for pack in self._lrucache) |
104 cachedpacks = {pack for pack in self._lrucache} |
105 # Yield for paths not in the cache. |
105 # Yield for paths not in the cache. |
106 for pack in self._packs - cachedpacks: |
106 for pack in self._packs - cachedpacks: |
107 self._lastpack = pack |
107 self._lastpack = pack |
108 yield pack |
108 yield pack |
109 |
109 |
257 # repack is going on in the background, and that should be pretty rare |
257 # repack is going on in the background, and that should be pretty rare |
258 # to have that happen twice in quick succession. |
258 # to have that happen twice in quick succession. |
259 newpacks = [] |
259 newpacks = [] |
260 if now > self.lastrefresh + REFRESHRATE: |
260 if now > self.lastrefresh + REFRESHRATE: |
261 self.lastrefresh = now |
261 self.lastrefresh = now |
262 previous = set(p.path for p in self.packs) |
262 previous = {p.path for p in self.packs} |
263 for filepath, __, __ in self._getavailablepackfilessorted(): |
263 for filepath, __, __ in self._getavailablepackfilessorted(): |
264 if filepath not in previous: |
264 if filepath not in previous: |
265 newpack = self.getpack(filepath) |
265 newpack = self.getpack(filepath) |
266 newpacks.append(newpack) |
266 newpacks.append(newpack) |
267 self.packs.add(newpack) |
267 self.packs.add(newpack) |