Hello community, here is the log from the commit of package perl-Mojo-Pg for openSUSE:Factory checked in at 2019-07-23 22:38:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojo-Pg (Old) and /work/SRC/openSUSE:Factory/.perl-Mojo-Pg.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojo-Pg" Tue Jul 23 22:38:37 2019 rev:18 rq:717836 version:4.14 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojo-Pg/perl-Mojo-Pg.changes 2019-01-28 20:49:50.921816349 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojo-Pg.new.4126/perl-Mojo-Pg.changes 2019-07-23 22:38:38.426955742 +0200 @@ -1,0 +2,12 @@ +Tue Jul 23 05:19:15 UTC 2019 - Stephan Kulow <co...@suse.com> + +- updated to 4.14 + see /usr/share/doc/packages/perl-Mojo-Pg/Changes + + 4.14 2019-07-22 + - Improved connection cache to be more than an order of magnitude faster for + blocking queries. + - Fixed a bug in Mojo::Pg::PubSub where listen/unlisten did not work while + reconnecting. + +------------------------------------------------------------------- Old: ---- Mojo-Pg-4.13.tar.gz New: ---- Mojo-Pg-4.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojo-Pg.spec ++++++ --- /var/tmp/diff_new_pack.CzAH1x/_old 2019-07-23 22:38:38.986955626 +0200 +++ /var/tmp/diff_new_pack.CzAH1x/_new 2019-07-23 22:38:38.986955626 +0200 @@ -17,7 +17,7 @@ Name: perl-Mojo-Pg -Version: 4.13 +Version: 4.14 Release: 0 %define cpan_name Mojo-Pg Summary: Wrapper around DBD::Pg for using PostgreSql with Mojolicious ++++++ Mojo-Pg-4.13.tar.gz -> Mojo-Pg-4.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/Changes new/Mojo-Pg-4.14/Changes --- old/Mojo-Pg-4.13/Changes 2019-01-20 23:32:08.000000000 +0100 +++ new/Mojo-Pg-4.14/Changes 2019-07-22 18:50:36.000000000 +0200 @@ -1,4 +1,10 @@ +4.14 2019-07-22 + - Improved connection cache to be more than an order of magnitude faster for + blocking queries. + - Fixed a bug in Mojo::Pg::PubSub where listen/unlisten did not work while + reconnecting. + 4.13 2019-01-20 - Added support for multi-column joins to SQL::Abstract::Pg. (rsindlin) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/META.json new/Mojo-Pg-4.14/META.json --- old/Mojo-Pg-4.13/META.json 2019-01-20 23:33:32.000000000 +0100 +++ new/Mojo-Pg-4.14/META.json 2019-07-22 20:16:50.000000000 +0200 @@ -4,7 +4,7 @@ "Sebastian Riedel <s...@cpan.org>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], @@ -57,6 +57,6 @@ }, "x_IRC" : "irc://irc.freenode.net/#mojo" }, - "version" : "4.13", - "x_serialization_backend" : "JSON::PP version 4.00" + "version" : "4.14", + "x_serialization_backend" : "JSON::PP version 4.04" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/META.yml new/Mojo-Pg-4.14/META.yml --- old/Mojo-Pg-4.13/META.yml 2019-01-20 23:33:32.000000000 +0100 +++ new/Mojo-Pg-4.14/META.yml 2019-07-22 20:16:50.000000000 +0200 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.36, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -30,5 +30,5 @@ homepage: https://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/mojolicious/mojo-pg.git -version: '4.13' +version: '4.14' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/lib/Mojo/Pg/Database.pm new/Mojo-Pg-4.14/lib/Mojo/Pg/Database.pm --- old/Mojo-Pg-4.13/lib/Mojo/Pg/Database.pm 2018-11-22 21:26:38.000000000 +0100 +++ new/Mojo-Pg-4.14/lib/Mojo/Pg/Database.pm 2019-07-22 18:41:26.000000000 +0200 @@ -135,8 +135,16 @@ sub _notifications { my $self = shift; - my $dbh = $self->dbh; - while (my $n = $dbh->pg_notifies) { $self->emit(notification => @$n) } + + my $dbh = $self->dbh; + my $n; + return undef unless $n = $dbh->pg_notifies; + while ($n) { + $self->emit(notification => @$n); + $n = $dbh->pg_notifies; + } + + return 1; } sub _unwatch { @@ -152,6 +160,7 @@ return if $self->{watching} || $self->{watching}++; my $dbh = $self->dbh; + $dbh->{private_mojo_async} = 1; unless ($self->{handle}) { open $self->{handle}, '<&', $dbh->{pg_socket} or die "Can't dup: $!"; } @@ -159,13 +168,14 @@ $self->{handle} => sub { my $reactor = shift; - $self->_unwatch if !eval { $self->_notifications; 1 }; - return unless $self->{waiting} && $dbh->pg_ready; + return $self->_unwatch if !$self->_notifications && !$self->{waiting}; + + return if !$self->{waiting} || !$dbh->pg_ready; my ($sth, $cb) = @{delete $self->{waiting}}{qw(sth cb)}; # Do not raise exceptions inside the event loop my $result = do { local $dbh->{RaiseError} = 0; $dbh->pg_result }; - my $err = defined $result ? undef : $dbh->errstr; + my $err = defined $result ? undef : $dbh->errstr; $self->$cb($err, $self->results_class->new(db => $self, sth => $sth)); $self->_unwatch unless $self->{waiting} || $self->is_listening; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/lib/Mojo/Pg/PubSub.pm new/Mojo-Pg-4.14/lib/Mojo/Pg/PubSub.pm --- old/Mojo-Pg-4.13/lib/Mojo/Pg/PubSub.pm 2018-11-24 12:40:08.000000000 +0100 +++ new/Mojo-Pg-4.14/lib/Mojo/Pg/PubSub.pm 2019-07-22 18:50:59.000000000 +0200 @@ -25,6 +25,7 @@ $db->once(close => sub { $self->emit(disconnect => delete $self->{db}) }); $db->listen($_) for keys %{$self->{chans}}, 'mojo.pubsub'; + delete $self->{reconnecting}; $self->emit(reconnect => $db); return $db; @@ -36,7 +37,8 @@ sub listen { my ($self, $name, $cb) = @_; - $self->db->listen($name) unless @{$self->{chans}{$name} ||= []}; + $self->db->listen($name) + if !@{$self->{chans}{$name} ||= []} && !$self->{reconnecting}; push @{$self->{chans}{$name}}, $cb; return $cb; } @@ -58,15 +60,21 @@ sub unlisten { my ($self, $name, $cb) = @_; + my $chan = $self->{chans}{$name}; - @$chan = $cb ? grep { $cb ne $_ } @$chan : (); - $self->db->unlisten($name) and delete $self->{chans}{$name} unless @$chan; + unless (@$chan = $cb ? grep { $cb ne $_ } @$chan : ()) { + $self->db->unlisten($name) unless $self->{reconnecting}; + delete $self->{chans}{$name}; + } + return $self; } sub _disconnect { my $self = shift; + $self->{reconnecting} = 1; + weaken $self; my $r; $r = Mojo::IOLoop->recurring( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/lib/Mojo/Pg.pm new/Mojo-Pg-4.14/lib/Mojo/Pg.pm --- old/Mojo-Pg-4.13/lib/Mojo/Pg.pm 2019-01-20 23:32:16.000000000 +0100 +++ new/Mojo-Pg-4.14/lib/Mojo/Pg.pm 2019-07-22 18:53:09.000000000 +0200 @@ -32,9 +32,9 @@ }; }; has [qw(password username)] => ''; -has pubsub => sub { Mojo::Pg::PubSub->new(pg => shift) }; +has pubsub => sub { Mojo::Pg::PubSub->new(pg => shift) }; -our $VERSION = '4.13'; +our $VERSION = '4.14'; sub db { $_[0]->database_class->new(dbh => $_[0]->_prepare, pg => $_[0]) } @@ -61,7 +61,7 @@ # Service and search_path my $hash = $url->query->to_hash; if (my $service = delete $hash->{service}) { $dsn .= "service=$service" } - if (my $path = delete $hash->{search_path}) { + if (my $path = delete $hash->{search_path}) { $self->search_path(ref $path ? $path : [$path]); } @@ -79,7 +79,9 @@ # Fork-safety delete @$self{qw(pid queue)} unless ($self->{pid} //= $$) eq $$; - while (my $dbh = shift @{$self->{queue} || []}) { return $dbh if $dbh->ping } + while (my $dbh = shift @{$self->{queue} || []}) { + return $dbh if $dbh->{Active}; + } my $dbh = DBI->connect(map { $self->$_ } qw(dsn username password options)); # Search path @@ -98,8 +100,10 @@ if (my $parent = $self->parent) { return $parent->_enqueue($dbh) } + # Async connections need to be checked more carefully my $queue = $self->{queue} ||= []; - push @$queue, $dbh if $dbh->{Active}; + push @$queue, $dbh + if $dbh->{Active} && (delete $dbh->{private_mojo_async} ? $dbh->ping : 1); shift @$queue while @$queue > $self->max_connections; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/lib/SQL/Abstract/Pg.pm new/Mojo-Pg-4.14/lib/SQL/Abstract/Pg.pm --- old/Mojo-Pg-4.13/lib/SQL/Abstract/Pg.pm 2019-01-20 23:27:46.000000000 +0100 +++ new/Mojo-Pg-4.14/lib/SQL/Abstract/Pg.pm 2019-06-30 13:13:00.000000000 +0200 @@ -172,8 +172,8 @@ my $sep = $self->{name_sep} // ''; for my $join (@join) { puke 'join must be in the form [$table, $fk => $pk]' if @$join < 3; - my $type = @$join % 2 == 0 ? shift @$join : ''; - my ($name, $fk, $pk, @morekeys) = @$join; + my ($type, $name, $fk, $pk, @morekeys) + = @$join % 2 == 0 ? @$join : ('', @$join); $table .= $self->_sqlcase($type =~ /^-(.+)$/ ? " $1 join " : ' join ') . $self->_quote($name) @@ -227,7 +227,7 @@ =head2 ON CONFLICT The C<on_conflict> option can be used to generate C<INSERT> queries with -C<ON CONFLICT> clauses. So far C<undef> to pass C<DO NOTHING>, array references +C<ON CONFLICT> clauses. So far, C<undef> to pass C<DO NOTHING>, array references to pass C<DO UPDATE> with conflict targets and a C<SET> expression, scalar references to pass literal SQL and array reference references to pass literal SQL with bind values are supported. @@ -323,8 +323,8 @@ =head2 GROUP BY The C<group_by> option can be used to generate C<SELECT> queries with -C<GROUP BY> clauses. So far array references to pass a list of fields and scalar -references to pass literal SQL are supported. +C<GROUP BY> clauses. So far, array references to pass a list of fields and +scalar references to pass literal SQL are supported. # "select * from some_table group by foo, bar" $abstract->select('some_table', '*', undef, {group_by => ['foo', 'bar']}); @@ -343,7 +343,7 @@ =head2 FOR The C<for> option can be used to generate C<SELECT> queries with C<FOR> clauses. -So far the scalar value C<update> to pass C<UPDATE> and scalar references to +So far, the scalar value C<update> to pass C<UPDATE> and scalar references to pass literal SQL are supported. # "select * from some_table for update" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/t/pod_coverage.t new/Mojo-Pg-4.14/t/pod_coverage.t --- old/Mojo-Pg-4.13/t/pod_coverage.t 2018-11-22 21:26:45.000000000 +0100 +++ new/Mojo-Pg-4.14/t/pod_coverage.t 2019-05-31 21:34:18.000000000 +0200 @@ -8,7 +8,7 @@ unless eval 'use Test::Pod::Coverage 1.04; 1'; my $private = ['insert', 'new', 'puke', 'select']; -my %RULES = ('SQL::Abstract::Pg' => {also_private => $private},); +my %RULES = ('SQL::Abstract::Pg' => {also_private => $private},); pod_coverage_ok($_, $RULES{$_} || {}) for all_modules(); done_testing(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/t/pubsub.t new/Mojo-Pg-4.14/t/pubsub.t --- old/Mojo-Pg-4.13/t/pubsub.t 2018-11-24 12:32:24.000000000 +0100 +++ new/Mojo-Pg-4.14/t/pubsub.t 2019-07-22 18:51:02.000000000 +0200 @@ -48,7 +48,7 @@ Mojo::IOLoop->next_tick(sub { $pg->db->notify(pstest => 'fail'); $pg->pubsub->notify('pstest')->notify(pstest => {msg => '♥works♥'}) - ->notify(pstest => [1, 2, 3])->notify(pstest => true) + ->notify(pstest => [1, 2, 3])->notify(pstest => true) ->notify(pstest2 => '♥works♥')->notify(pstest => {msg => 'stop'}); }); Mojo::IOLoop->start; @@ -89,7 +89,7 @@ # Reconnect while listening $pg = Mojo::Pg->new($ENV{TEST_ONLINE}); my @dbhs = @test = (); -$pg->pubsub->on(reconnect => sub { push @dbhs, pop->dbh }); +$pg->pubsub->on(reconnect => sub { push @dbhs, pop->dbh }); $pg->pubsub->listen(pstest => sub { push @test, pop }); ok $dbhs[0], 'database handle'; is_deeply \@test, [], 'no messages'; @@ -107,19 +107,29 @@ # Reconnect while listening multiple retries $pg = Mojo::Pg->new($ENV{TEST_ONLINE}); @dbhs = @test = (); +my (@test3, @test4); $pg->pubsub->reconnect_interval(0.1); $pg->pubsub->on(reconnect => sub { push @dbhs, pop->dbh }); -$pg->pubsub->listen(pstest => sub { push @test, pop }); +$pg->pubsub->listen(pstest => sub { push @test, pop }); +$pg->pubsub->listen(pstest4 => sub { push @test4, pop }); ok $dbhs[0], 'database handle'; is_deeply \@test, [], 'no messages'; { local $dbhs[0]{Warn} = 0; $pg->pubsub->on( - reconnect => sub { shift->notify(pstest => 'works'); Mojo::IOLoop->stop }); + reconnect => sub { + shift->notify(pstest => 'works')->notify(pstest3 => 'works too') + ->notify(pstest4 => 'failed'); + Mojo::IOLoop->stop; + } + ); my $dsn = $pg->dsn; $pg->pubsub->on( disconnect => sub { + my $pubsub = shift; Mojo::IOLoop->timer(0.2 => sub { $pg->dsn($dsn) }); + $pubsub->listen(pstest3 => sub { push @test3, pop }); + $pubsub->unlisten('pstest4'); } ); $pg->db->query('select pg_terminate_backend(?)', $dbhs[0]{pg_pid}); @@ -127,7 +137,9 @@ Mojo::IOLoop->start; ok $dbhs[1], 'database handle'; isnt $dbhs[0], $dbhs[1], 'different database handles'; - is_deeply \@test, ['works'], 'right messages'; + is_deeply \@test, ['works'], 'right messages'; + is_deeply \@test3, ['works too'], 'right messages'; + is_deeply \@test4, [], 'no messages'; }; # Reconnect while not listening @@ -152,7 +164,7 @@ # Reset $pg = Mojo::Pg->new($ENV{TEST_ONLINE}); @dbhs = @test = (); -$pg->pubsub->on(reconnect => sub { push @dbhs, pop->dbh }); +$pg->pubsub->on(reconnect => sub { push @dbhs, pop->dbh }); $pg->pubsub->listen(pstest => sub { push @test, pop }); ok $dbhs[0], 'database handle'; $pg->pubsub->notify(pstest => 'first'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/t/results.t new/Mojo-Pg-4.14/t/results.t --- old/Mojo-Pg-4.13/t/results.t 2018-11-22 21:26:44.000000000 +0100 +++ new/Mojo-Pg-4.14/t/results.t 2019-05-31 21:34:18.000000000 +0200 @@ -79,14 +79,14 @@ "select 'a' as bar, ?::json as foo union all select 'b' as bar, ?::json as foo", {json => {one => 1}}, - {json => {two => 2}} + {json => {two => 2}} )->expand->hashes->to_array, $hashes, 'right structure'; my $arrays = [['a', {one => 1}], ['b', {two => 2}]]; is_deeply $db->query( "select 'a' as bar, ?::json as foo union all select 'b' as bar, ?::json as foo", {json => {one => 1}}, - {json => {two => 2}} + {json => {two => 2}} )->expand->arrays->to_array, $arrays, 'right structure'; # Iterate diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojo-Pg-4.13/t/sql.t new/Mojo-Pg-4.14/t/sql.t --- old/Mojo-Pg-4.13/t/sql.t 2019-01-20 23:23:43.000000000 +0100 +++ new/Mojo-Pg-4.14/t/sql.t 2019-05-31 21:34:17.000000000 +0200 @@ -103,7 +103,7 @@ 'right query'; @sql = $abstract->select( 'foo', '*', - {bar => {'>' => 'baz'}}, + {bar => {'>' => 'baz'}}, {group_by => ['bar'], having => {baz => {'<' => 'bar'}}} ); $result = [