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()) {
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
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