Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Mojolicious-Plugin-AssetPack for openSUSE:Factory checked in at 2023-02-08 17:20:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack (Old) and /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new.4462 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Mojolicious-Plugin-AssetPack" Wed Feb 8 17:20:50 2023 rev:48 rq:1063835 version:2.14 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-AssetPack/perl-Mojolicious-Plugin-AssetPack.changes 2021-03-18 22:54:45.699519239 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-AssetPack.new.4462/perl-Mojolicious-Plugin-AssetPack.changes 2023-02-08 17:21:16.114230448 +0100 @@ -1,0 +2,6 @@ +Wed Feb 8 10:32:17 UTC 2023 - OndÅej Súkup <mimi...@gmail.com> + +- updated to 2.14 +* added support for retry during download assets + +------------------------------------------------------------------- Old: ---- Mojolicious-Plugin-AssetPack-2.13.tar.gz New: ---- Mojolicious-Plugin-AssetPack-2.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Mojolicious-Plugin-AssetPack.spec ++++++ --- /var/tmp/diff_new_pack.KIcGeF/_old 2023-02-08 17:21:16.614232902 +0100 +++ /var/tmp/diff_new_pack.KIcGeF/_new 2023-02-08 17:21:16.618232921 +0100 @@ -1,7 +1,7 @@ # # spec file for package perl-Mojolicious-Plugin-AssetPack # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define cpan_name Mojolicious-Plugin-AssetPack Name: perl-Mojolicious-Plugin-AssetPack -Version: 2.13 +Version: 2.14 Release: 0 Summary: Compress and convert CSS, Less, Sass, JavaScript and CoffeeScript files License: Artistic-2.0 ++++++ Mojolicious-Plugin-AssetPack-2.13.tar.gz -> Mojolicious-Plugin-AssetPack-2.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/.github/workflows/linux.yml new/Mojolicious-Plugin-AssetPack-2.14/.github/workflows/linux.yml --- old/Mojolicious-Plugin-AssetPack-2.13/.github/workflows/linux.yml 2021-03-11 00:08:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/.github/workflows/linux.yml 2021-10-29 21:01:54.000000000 +0200 @@ -29,6 +29,7 @@ - name: Install dependencies run: | cpanm -n --installdeps . + cpanm -n CSS::Minifier::XS JavaScript::Minifier::XS cpanm -n Test::Pod Test::Pod::Coverage - name: Run tests run: prove -l t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/.mergify/config.yml new/Mojolicious-Plugin-AssetPack-2.14/.mergify/config.yml --- old/Mojolicious-Plugin-AssetPack-2.13/.mergify/config.yml 2021-03-11 00:08:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/.mergify/config.yml 2021-10-29 21:01:54.000000000 +0200 @@ -4,13 +4,13 @@ - "#approved-reviews-by>=2" - "#changes-requested-reviews-by=0" - label!=work in progress - - base=master + - base=main actions: merge: method: merge - name: remove outdated reviews conditions: - - base=master + - base=main actions: dismiss_reviews: {} - name: ask to resolve conflict diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/Changes new/Mojolicious-Plugin-AssetPack-2.14/Changes --- old/Mojolicious-Plugin-AssetPack-2.13/Changes 2021-03-13 17:55:56.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/Changes 2023-01-27 16:33:22.000000000 +0100 @@ -1,4 +1,7 @@ +2.14 2023-01-27 + - Added support for multiple download attempts for assets that need to be fetched. + 2.13 2021-03-13 - Restored documentation. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/MANIFEST new/Mojolicious-Plugin-AssetPack-2.14/MANIFEST --- old/Mojolicious-Plugin-AssetPack-2.13/MANIFEST 2021-03-13 17:57:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/MANIFEST 2023-01-27 17:38:44.000000000 +0100 @@ -77,6 +77,7 @@ t/favicon.t t/fetch-all.t t/fetch-hash.t +t/fetch-retry.t t/fetch-source-map.t t/font-awesome.t t/from-helper.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/META.json new/Mojolicious-Plugin-AssetPack-2.14/META.json --- old/Mojolicious-Plugin-AssetPack-2.13/META.json 2021-03-13 17:57:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/META.json 2023-01-27 17:38:44.000000000 +0100 @@ -4,7 +4,7 @@ "Sebastian Riedel <s...@cpan.org>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], @@ -55,6 +55,6 @@ "web" : "https://github.com/mojolicious/mojo-assetpack" } }, - "version" : "2.13", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "2.14", + "x_serialization_backend" : "JSON::PP version 4.07" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/META.yml new/Mojolicious-Plugin-AssetPack-2.14/META.yml --- old/Mojolicious-Plugin-AssetPack-2.13/META.yml 2021-03-13 17:57:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/META.yml 2023-01-27 17:38:44.000000000 +0100 @@ -8,7 +8,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.60, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -26,5 +26,5 @@ bugtracker: https://github.com/mojolicious/mojo-assetpack/issues homepage: https://github.com/mojolicious/mojo-assetpack repository: https://github.com/mojolicious/mojo-assetpack.git -version: '2.13' +version: '2.14' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/lib/Mojolicious/Plugin/AssetPack/Store.pm new/Mojolicious-Plugin-AssetPack-2.14/lib/Mojolicious/Plugin/AssetPack/Store.pm --- old/Mojolicious-Plugin-AssetPack-2.13/lib/Mojolicious/Plugin/AssetPack/Store.pm 2021-03-11 00:08:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/lib/Mojolicious/Plugin/AssetPack/Store.pm 2023-01-27 16:32:25.000000000 +0100 @@ -8,6 +8,7 @@ use Mojolicious::Types; use Mojolicious::Plugin::AssetPack::Asset; use Mojolicious::Plugin::AssetPack::Util qw(diag checksum has_ro DEBUG); +use Time::HiRes qw(sleep); use constant CACHE_DIR => 'cache'; @@ -26,6 +27,8 @@ has default_headers => sub { +{"Cache-Control" => "max-age=31536000"} }; has fallback_headers => sub { +{"Cache-Control" => "max-age=60"} }; has fallback_templates => sub { +{%FALLBACK_TEMPLATES} }; +has retry_delay => 3; +has retries => 0; has _types => sub { my $t = Mojolicious::Types->new; @@ -257,14 +260,22 @@ return $asset if $attrs{url}->host ne 'local' and $asset = $self->_already_downloaded($url); - my $tx = $self->ua->get($url); - my $h = $tx->res->headers; + my $tx; + my $retries = $self->retries; + while (1) { + $tx = $self->ua->get($url); + last unless my $err = $tx->error; + + if ($retries-- > 0) { + sleep $self->retry_delay; + next; + } - if (my $err = $tx->error) { $self->_log->warn("[AssetPack] Unable to download $url: $err->{message}"); return undef; } + my $h = $tx->res->headers; my $ct = $h->content_type || ''; if ($ct ne 'text/plain') { $ct =~ s!;.*$!!; @@ -388,6 +399,20 @@ See L<Mojolicious::Static/paths> for details. +=head2 retry_delay + + my $delay = $self->retry_delay; + $self = $self->retry_delay(0.5); + +Delay in seconds between download attempts for assets that need to be fetched, defaults to C<3>. + +=head2 retries + + my $retries = $self->retries; + $self = $self->retries(5); + +Number of times asset downloads will be attempted for assets that need to be fetched, defaults to C<0>. + =head2 ua $ua = $self->ua; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/lib/Mojolicious/Plugin/AssetPack.pm new/Mojolicious-Plugin-AssetPack-2.14/lib/Mojolicious/Plugin/AssetPack.pm --- old/Mojolicious-Plugin-AssetPack-2.13/lib/Mojolicious/Plugin/AssetPack.pm 2021-03-13 17:55:35.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/lib/Mojolicious/Plugin/AssetPack.pm 2023-01-27 15:16:26.000000000 +0100 @@ -6,7 +6,7 @@ use Mojolicious::Plugin::AssetPack::Store; use Mojolicious::Plugin::AssetPack::Util qw(diag has_ro load_module DEBUG); -our $VERSION = '2.13'; +our $VERSION = '2.14'; has minify => sub { shift->_app->mode eq 'development' ? 0 : 1 }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/t/fetch-retry.t new/Mojolicious-Plugin-AssetPack-2.14/t/fetch-retry.t --- old/Mojolicious-Plugin-AssetPack-2.13/t/fetch-retry.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/t/fetch-retry.t 2023-01-27 16:32:25.000000000 +0100 @@ -0,0 +1,47 @@ +use lib '.'; +use t::Helper; + +use Mojo::IOLoop; +use Mojo::Server::Daemon; +use Mojolicious; + +my $t = t::Helper->t(pipes => [qw(Css Fetch)]); + +my $app = Mojolicious->new; +$app->config->{attempts} = 0; +$app->routes->get( + '/test.css' => sub { + my $c = shift; + return $c->render(data => 'Internal server error', status => 500) if $c->app->config->{attempts}++ <= 2; + $c->render(data => 'body { color: #00f }'); + } +); +my $responses = []; +$app->hook( + before_dispatch => sub { + shift->on(finish => sub { push @$responses, shift->res->code }); + } +); +my $daemon = Mojo::Server::Daemon->new(listen => ['http://*'], ioloop => $t->app->asset->ua->ioloop, app => $app); +my $port = $daemon->start->ports->[0]; + +subtest 'Defaults' => sub { + is $t->app->asset->store->retries, 0, 'no retries by default'; + is $t->app->asset->store->retry_delay, 3, '3 second retry delay by default'; +}; + +subtest 'Download asset with multiple attempts' => sub { + $t->app->asset->store->retries(3)->retry_delay(0.1); + $t->app->asset->process('app.css' => "http://127.0.0.1:$port/test.css"); + + $t->get_ok('/')->status_is(200)->content_like(qr{Hello world}); + $t->get_ok($t->tx->res->dom->at('link')->{href})->status_is(200)->content_like(qr{body.+color.+00f}); + is_deeply $responses, [500, 500, 500, 200], 'right responses'; +}; + +done_testing; + +__DATA__ +@@ index.html.ep +%= asset 'app.css' +Hello world diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Mojolicious-Plugin-AssetPack-2.13/t/register.t new/Mojolicious-Plugin-AssetPack-2.14/t/register.t --- old/Mojolicious-Plugin-AssetPack-2.13/t/register.t 2021-03-11 00:08:15.000000000 +0100 +++ new/Mojolicious-Plugin-AssetPack-2.14/t/register.t 2023-01-27 15:17:13.000000000 +0100 @@ -11,7 +11,7 @@ delete $t->app->log->{$_} for qw(path handle); $t->app->plugin(AssetPack => {helper => 'foo', pipes => ['Css']}); isa_ok $t->app->foo, 'Mojolicious::Plugin::AssetPack'; -is $t->app->foo->ua->server->app, $t->app, 'app'; +is $t->app->foo->ua->server->app, $t->app, 'app'; is $t->app->foo->ua->proxy->http, 'example.com', 'proxy http'; $t->app->foo->process('x.css' => 'a.css');