projects
/
APKPM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use columns.table and test it since web interface uses it
[APKPM.git]
/
web_ui.pl
diff --git
a/web_ui.pl
b/web_ui.pl
index
21673c4
..
19f435f
100755
(executable)
--- a/
web_ui.pl
+++ b/
web_ui.pl
@@
-96,7
+96,7
@@
get '/table/:table' => sub {
# generate result as Store_sql does
# generate result as Store_sql does
- my @c = split(/\s+/, $redis->get("
pg
.$table"));
+ my @c = split(/\s+/, $redis->get("
columns
.$table"));
my ($hash_col) = grep { $c[$_] eq 'h' } 0 .. $#c;
$ret = {
my ($hash_col) = grep { $c[$_] eq 'h' } 0 .. $#c;
$ret = {
@@
-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;
}