summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/p5solv2
-rwxr-xr-xexamples/pysolv5
-rwxr-xr-xexamples/rbsolv2
3 files changed, 4 insertions, 5 deletions
diff --git a/examples/p5solv b/examples/p5solv
index 94f5e7a..15487e1 100755
--- a/examples/p5solv
+++ b/examples/p5solv
@@ -52,7 +52,7 @@ sub load {
my $dorefresh = $self->{'autorefresh'};
if ($dorefresh) {
my @s = stat($self->cachepath());
- $dorefresh = 0 if @s && time() - $s[9] < $self->{'metadata_expire'};
+ $dorefresh = 0 if @s && ($self->{'metadata_expire'} == -1 || time() - $s[9] < $self->{'metadata_expire'});
}
$self->{'cookie'} = '';
if (!$dorefresh && $self->usecachedrepo()) {
diff --git a/examples/pysolv b/examples/pysolv
index 486ed98..f529d5d 100755
--- a/examples/pysolv
+++ b/examples/pysolv
@@ -75,12 +75,11 @@ class repo_generic(dict):
self.handle = pool.add_repo(self.name)
self.handle.appdata = self
self.handle.priority = 99 - self['priority']
- if self['autorefresh']:
- dorefresh = True
+ dorefresh = bool(int(self['autorefresh']))
if dorefresh:
try:
st = os.stat(self.cachepath())
- if time.time() - st[ST_MTIME] < self['metadata_expire']:
+ if self['metadata_expire'] == -1 or time.time() - st[ST_MTIME] < self['metadata_expire']:
dorefresh = False
except OSError, e:
pass
diff --git a/examples/rbsolv b/examples/rbsolv
index 333114b..c961b27 100755
--- a/examples/rbsolv
+++ b/examples/rbsolv
@@ -52,7 +52,7 @@ class Repo_generic
if dorefresh
begin
s = File.stat(cachepath)
- dorefresh = false if s && Time.now - s.mtime < @attribs['metadata_expire'].to_i
+ dorefresh = false if s && (@attribs['metadata_expire'].to_i == -1 || Time.now - s.mtime < @attribs['metadata_expire'].to_i)
rescue SystemCallError
end
end