Fix refresh of cache in case of empty file
This commit is contained in:
parent
79912d5d73
commit
0cf5a2b8c5
1 changed files with 6 additions and 2 deletions
|
|
@ -110,6 +110,7 @@ if ($ARGV[0] and $ARGV[0] eq "config") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
my $refresh;
|
||||||
my $first = 1;
|
my $first = 1;
|
||||||
my $time = time();
|
my $time = time();
|
||||||
# Check if cache exist and not older than 3 hours
|
# Check if cache exist and not older than 3 hours
|
||||||
|
|
@ -118,9 +119,12 @@ else {
|
||||||
LOOP: while(<CACHE>) {
|
LOOP: while(<CACHE>) {
|
||||||
if ($first) {
|
if ($first) {
|
||||||
if ($time - $_ > $refreshtime) {
|
if ($time - $_ > $refreshtime) {
|
||||||
$cache = 0;
|
$refresh = 0;
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
$refresh = 1;
|
||||||
|
}
|
||||||
$first = 0;
|
$first = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -129,7 +133,7 @@ else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(CACHE);
|
close(CACHE);
|
||||||
exit if $cache;
|
exit if $cache and $refresh;
|
||||||
|
|
||||||
# Open cache for writing and execute weboob
|
# Open cache for writing and execute weboob
|
||||||
open(CACHE, "> " . $cachefile) or die "Failed to open file $cachefile";
|
open(CACHE, "> " . $cachefile) or die "Failed to open file $cachefile";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue