projects
/
APKPM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
don't cache timeout errors from gearman
[APKPM.git]
/
web_ui.pl
diff --git
a/web_ui.pl
b/web_ui.pl
index
21673c4
..
36d00de
100755
(executable)
--- a/
web_ui.pl
+++ b/
web_ui.pl
@@
-143,26
+143,25
@@
sub _gearman_redis {
warn "# _gearman_redis $key [$timeout s]";
my $redis = Redis->new;
warn "# _gearman_redis $key [$timeout s]";
my $redis = Redis->new;
- my $
ret
;
+ my $
json
;
- if ( $
ret
= $redis->get($key) ) {
+ if ( $
json
= $redis->get($key) ) {
warn "redis hit $key\n";
} else {
$gearman->timeout($timeout);
warn "redis hit $key\n";
} else {
$gearman->timeout($timeout);
- $ret = $gearman->req( 'SUBMIT_JOB', $job, '', $params );
- die "no result for $params" unless $ret;
-
- $redis->set($key => $ret);
+ $json = $gearman->req( 'SUBMIT_JOB', $job, '', $params );
+ die "no result for $params" unless $json;
}
}
- $redis->expire($key => 60); # refresh redis key timeout
-
- $ret = Mojo::JSON->new->decode( $ret );
+ my $ret = Mojo::JSON->new->decode( $json );
if ( ! exists $ret->{error} && ref $ret->{columns} ne 'ARRAY' ) {
$ret->{error} = 'query run longer than ' . $gearman->timeout . ' s timeout';
}
if ( ! exists $ret->{error} && ref $ret->{columns} ne 'ARRAY' ) {
$ret->{error} = 'query run longer than ' . $gearman->timeout . ' s timeout';
}
+ $redis->set($key => $json);
+ $redis->expire($key => 60); # refresh redis key timeout
+
return $ret;
}
return $ret;
}