Skip to content
Permalink
Browse files

Use redis pipelining

  • Loading branch information...
nigelhorne committed Nov 8, 2019
1 parent 3c1fb68 commit 69ec93390f4146d5c773ad34bd2c55030754f1df
Showing with 11 additions and 3 deletions.
  1. +3 −1 .travis.yml
  2. +8 −2 createdatabase.PL
@@ -39,11 +39,13 @@ before_install:
install:
- cpan-install --deps
- cpan-install --coverage
- cpanm -n Devel::Cover::Report::Coveralls Locale::Country Test::Pod::Spelling::CommonMistakes FCGI::Buffer Log::WarnDie
- cpanm -n Devel::Cover::Report::Coveralls Locale::Country Test::Pod::Spelling::CommonMistakes FCGI::Buffer Log::WarnDie B::Lint

script:
# perl Makefile.PL && make && cover -test -report coveralls
- perl Makefile.PL && make && prove -l -j$(test-jobs) $(test-files)

after_success:
- coverage-report
- perl -MO=Lint ./createdatabase.PL
- perl -c -Mwarnings::unused ./createdatabase.PL
@@ -49,6 +49,7 @@ use constant DEBUG_DETERMINE_LOCATION => 8;
use constant DEBUG_GET_WOF => 0x10;
use constant DEBUG_BREAKUP => 0x20;
use constant DEBUG_DATA_VALIDATE => 0x40;
use constant DEBUG_FLUSH => 0x80;
use constant DEBUG_ALL => 0xFF;
use constant DEBUG => DEBUG_OFF;

@@ -2339,7 +2340,7 @@ sub flush_queue
{
my ($dbh, $redis) = @_;

# print "flush\n" if(DEBUG&DEBUG_ALL);
print "flush\n" if(DEBUG&DEBUG_FLUSH);

# my @columns = ('LAT','LON','NUMBER','STREET','CITY','COUNTY','STATE','COUNTRY');
# my @columns = ('LAT','LON','NAME','NUMBER','STREET');
@@ -2391,7 +2392,8 @@ sub flush_queue
# print "$md5: ", Data::Dumper->new([$row])->Dump();

if($redis) {
$redis->hmset($md5, 'LAT', $row->{'LAT'}, 'LON', $row->{'LON'});
print "writing to redis\n" if(DEBUG&DEBUG_FLUSH);
$redis->hmset($md5, 'LAT', $row->{'LAT'}, 'LON', $row->{'LON'}, sub {});
}
$query .= $row->{'LAT'} . ',' . $row->{'LON'} . ",'$md5')";

@@ -2411,6 +2413,10 @@ sub flush_queue
# die $key unless $cities{$key};
# $query .= $cities{$key} . ",'$md5')";
}
if($redis) {
print "waiting for redis\n" if(DEBUG&DEBUG_FLUSH);
$redis->wait_all_responses();
}

my $tree_query;
# while(my($md5, $row) = each %queued_commits) {

0 comments on commit 69ec933

Please sign in to comment.
You can’t perform that action at this time.