Skip to content

Commit

Permalink
Use map()
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Dec 20, 2023
1 parent 606e906 commit 5d58d11
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions createdatabase.PL
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,8 @@ if($berkeley_db) {
untie %db_tie;
}
if($redis) {
print "waiting for redis\n" if(DEBUG&DEBUG_FLUSH);
$redis->wait_all_responses(); # Pipelining mode
$redis->bgsave();
$redis->shutdown();
}
Expand Down Expand Up @@ -2852,10 +2854,6 @@ 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) {
Expand Down Expand Up @@ -2992,11 +2990,13 @@ sub flush_queue
}
if($redis) {
print "writing to redis\n" if(DEBUG&DEBUG_FLUSH);
my %data;
while(my($k, $row) = each(%queued_commits)) {
$data{$k} = $row->{'LAT'} . ',' . $row->{'LON'};
}
$redis->mset(%data);
my %data = map {
my $row = $queued_commits{$_};
$_ => $row->{'LAT'} . ',' . $row->{'LON'}
} keys %queued_commits;

# The sub {} means that we use pipelining mode
$redis->mset(%data, sub {});
}
}
# if($tree_query) {
Expand Down

0 comments on commit 5d58d11

Please sign in to comment.