[PATCH 1/3] Use cache for base repo if possible
Brian C. Lane
bcl at redhat.com
Mon Oct 21 19:11:51 UTC 2013
On Wed, Oct 16, 2013 at 03:26:21PM +0200, Vratislav Podzimek wrote:
> - base_repo_name = repo_name
> + with self._br_cache_valid_lock:
> + # cache the value for multiple use
> + self._cached_base_repo = repo_name
> + self._br_cache_valid = True
> + current_cached = self._cached_base_repo
> break
> -
> - return base_repo_name
> + else:
> + # didn't find any base repo set and enabled
> + with self._br_cache_valid_lock:
> + # set the cache to None, but make it valid
> + self._cached_base_repo = None
> + self._br_cache_valid = True
> + current_cached = self._cached_base_repo
> +
> + with self._br_refresh_lock:
> + # go through scheduled callbacks (if any) and remove them
> + for callback in self._br_callbacks:
> + callback(current_cached)
> + self._br_callbacks.remove(callback)
Why not just use self._cached_base_repo? I don't see any reason to
assign it to current_cached.
Other than that minor complaint these all look ok to me too.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list