Hello community,

here is the log from the commit of package perl-Mojolicious-Plugin-Status for 
openSUSE:Factory checked in at 2020-02-13 10:11:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-Status (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-Status.new.26092 
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Mojolicious-Plugin-Status"

Thu Feb 13 10:11:09 2020 rev:4 rq:773594 version:1.02

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/perl-Mojolicious-Plugin-Status/perl-Mojolicious-Plugin-Status.changes
    2019-10-12 22:36:36.678720196 +0200
+++ 
/work/SRC/openSUSE:Factory/.perl-Mojolicious-Plugin-Status.new.26092/perl-Mojolicious-Plugin-Status.changes
 2020-02-13 10:11:09.780327707 +0100
@@ -1,0 +2,10 @@
+Tue Feb 11 03:09:46 UTC 2020 -  <[email protected]>
+
+- updated to 1.02
+   see /usr/share/doc/packages/perl-Mojolicious-Plugin-Status/Changes
+
+  1.02  2020-02-10
+    - Switched to File::Map as storage backend, so this plugin should be much
+      more reliable and safer to use now. (kraih, haarg, leont)
+
+-------------------------------------------------------------------

Old:
----
  Mojolicious-Plugin-Status-1.01.tar.gz

New:
----
  Mojolicious-Plugin-Status-1.02.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Mojolicious-Plugin-Status.spec ++++++
--- /var/tmp/diff_new_pack.fDqnbK/_old  2020-02-13 10:11:10.356328041 +0100
+++ /var/tmp/diff_new_pack.fDqnbK/_new  2020-02-13 10:11:10.360328043 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package perl-Mojolicious-Plugin-Status
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Mojolicious-Plugin-Status
-Version:        1.01
+Version:        1.02
 Release:        0
 %define cpan_name Mojolicious-Plugin-Status
 Summary:        Mojolicious server status
@@ -31,11 +31,11 @@
 BuildRequires:  perl
 BuildRequires:  perl-macros
 BuildRequires:  perl(BSD::Resource)
-BuildRequires:  perl(IPC::ShareLite)
+BuildRequires:  perl(File::Map)
 BuildRequires:  perl(Mojolicious) >= 7.88
 BuildRequires:  perl(Sereal)
 Requires:       perl(BSD::Resource)
-Requires:       perl(IPC::ShareLite)
+Requires:       perl(File::Map)
 Requires:       perl(Mojolicious) >= 7.88
 Requires:       perl(Sereal)
 %{perl_requires}
@@ -43,9 +43,8 @@
 %description
 Mojolicious::Plugin::Status is a Mojolicious plugin providing a server
 status ui for Mojo::Server::Daemon and Mojo::Server::Prefork. Note that
-this module is *EXPERIMENTAL* because the IPC mechanism used can be
-unreliable and slow down the whole application significantly. Therefore it
-should currently only be used for debugging purposes.
+this module is *EXPERIMENTAL* and should therefore only be used for
+debugging purposes.
 
 %prep
 %setup -q -n %{cpan_name}-%{version}

++++++ Mojolicious-Plugin-Status-1.01.tar.gz -> 
Mojolicious-Plugin-Status-1.02.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-Status-1.01/Changes 
new/Mojolicious-Plugin-Status-1.02/Changes
--- old/Mojolicious-Plugin-Status-1.01/Changes  2019-10-07 11:20:00.000000000 
+0200
+++ new/Mojolicious-Plugin-Status-1.02/Changes  2020-02-10 17:06:08.000000000 
+0100
@@ -1,4 +1,8 @@
 
+1.02  2020-02-10
+  - Switched to File::Map as storage backend, so this plugin should be much
+    more reliable and safer to use now. (kraih, haarg, leont)
+
 1.01  2019-10-07
   - The IPC mechanism used by this module is unreliable, so production use is
     strongly discouraged.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-Status-1.01/META.json 
new/Mojolicious-Plugin-Status-1.02/META.json
--- old/Mojolicious-Plugin-Status-1.01/META.json        2019-10-07 
14:04:27.000000000 +0200
+++ new/Mojolicious-Plugin-Status-1.02/META.json        2020-02-10 
17:07:03.000000000 +0100
@@ -4,7 +4,7 @@
       "Sebastian Riedel <[email protected]>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter 
version 2.150010",
+   "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter 
version 2.150010",
    "license" : [
       "artistic_2"
    ],
@@ -34,7 +34,7 @@
       "runtime" : {
          "requires" : {
             "BSD::Resource" : "0",
-            "IPC::ShareLite" : "0",
+            "File::Map" : "0",
             "Mojolicious" : "7.88",
             "Sereal" : "0",
             "perl" : "5.010001"
@@ -57,6 +57,6 @@
       },
       "x_IRC" : "irc://irc.freenode.net/#mojo"
    },
-   "version" : "1.01",
+   "version" : "1.02",
    "x_serialization_backend" : "JSON::PP version 4.04"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-Status-1.01/META.yml 
new/Mojolicious-Plugin-Status-1.02/META.yml
--- old/Mojolicious-Plugin-Status-1.01/META.yml 2019-10-07 14:04:27.000000000 
+0200
+++ new/Mojolicious-Plugin-Status-1.02/META.yml 2020-02-10 17:07:03.000000000 
+0100
@@ -7,7 +7,7 @@
 configure_requires:
   ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 
2.150010'
 license: artistic_2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -20,7 +20,7 @@
     - t
 requires:
   BSD::Resource: '0'
-  IPC::ShareLite: '0'
+  File::Map: '0'
   Mojolicious: '7.88'
   Sereal: '0'
   perl: '5.010001'
@@ -30,5 +30,5 @@
   homepage: https://mojolicious.org
   license: http://www.opensource.org/licenses/artistic-license-2.0
   repository: https://github.com/mojolicious/mojo-status.git
-version: '1.01'
+version: '1.02'
 x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-Status-1.01/Makefile.PL 
new/Mojolicious-Plugin-Status-1.02/Makefile.PL
--- old/Mojolicious-Plugin-Status-1.01/Makefile.PL      2018-09-18 
11:43:11.000000000 +0200
+++ new/Mojolicious-Plugin-Status-1.02/Makefile.PL      2020-02-10 
14:25:23.000000000 +0100
@@ -30,10 +30,10 @@
     },
   },
   PREREQ_PM => {
-    Mojolicious      => '7.88',
-    'BSD::Resource'  => 0,
-    'IPC::ShareLite' => 0,
-    Sereal           => 0
+    Mojolicious     => '7.88',
+    'BSD::Resource' => 0,
+    'File::Map'     => 0,
+    Sereal          => 0
   },
   test => {TESTS => 't/*.t'}
 );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Mojolicious-Plugin-Status-1.01/README.md 
new/Mojolicious-Plugin-Status-1.02/README.md
--- old/Mojolicious-Plugin-Status-1.01/README.md        2019-10-07 
14:02:44.000000000 +0200
+++ new/Mojolicious-Plugin-Status-1.02/README.md        2020-02-10 
16:21:50.000000000 +0100
@@ -4,10 +4,8 @@
 
![Screenshot](https://raw.github.com/mojolicious/mojo-status/master/examples/status.png?raw=true)
 
   A server status ui for the [Mojolicious](https://mojolicious.org) real-time
-  web framework. Note that this module is **EXPERIMENTAL** because the IPC
-  mechanism used can be unreliable and slow down the whole application
-  significantly. Therefore it should currently only be used for debugging
-  purposes.
+  web framework. Note that this module is **EXPERIMENTAL** and should therefore
+  only be used for debugging purposes.
 
 ```perl
 use Mojolicious::Lite;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/Mojolicious-Plugin-Status-1.01/lib/Mojolicious/Plugin/Status.pm 
new/Mojolicious-Plugin-Status-1.02/lib/Mojolicious/Plugin/Status.pm
--- old/Mojolicious-Plugin-Status-1.01/lib/Mojolicious/Plugin/Status.pm 
2019-10-07 14:03:24.000000000 +0200
+++ new/Mojolicious-Plugin-Status-1.02/lib/Mojolicious/Plugin/Status.pm 
2020-02-10 17:01:34.000000000 +0100
@@ -2,12 +2,12 @@
 use Mojo::Base 'Mojolicious::Plugin';
 
 use BSD::Resource 'getrusage';
-use IPC::ShareLite;
+use File::Map 'map_anonymous';
 use Time::HiRes 'time';
-use Mojo::File 'path';
+use Mojo::File qw(path tempfile);
 use Mojo::IOLoop;
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 
 sub register {
   my ($self, $app, $config) = @_;
@@ -15,9 +15,12 @@
   # Config
   my $prefix = $config->{route} // $app->routes->any('/mojo-status');
   $prefix->to(return_to => $config->{return_to} // '/');
-  $self->{key} = $config->{shm_key} || '1234';
+  my $size = $config->{size} ||= 52428800;
 
   # Initialize cache
+  $self->{tempfile} = tempfile->touch;
+  map_anonymous my $map, $config->{size}, 'shared';
+  $self->{map} = \$map;
   $self->_guard->_store({started => time, processed => 0});
 
   # Only the two built-in servers are supported for now
@@ -54,12 +57,9 @@
 
 sub _guard {
   my $self = shift;
-
-  my $share = $self->{share}
-    ||= IPC::ShareLite->new(-key => $self->{key}, -create => 1, -destroy => 0)
-    || die $!;
-
-  return Mojolicious::Plugin::Status::_Guard->new(share => $share);
+  my $fh   = $self->{fh}{$$} ||= $self->{tempfile}->open('>');
+  return Mojolicious::Plugin::Status::_Guard->new(fh => $fh,
+    map => $self->{map});
 }
 
 sub _read_write {
@@ -141,7 +141,7 @@
   # Collect stats
   $app->hook(after_build_tx  => sub { $self->_tx(@_) });
   $app->hook(before_dispatch => sub { $self->_request(@_) });
-  Mojo::IOLoop->next_tick(sub      { $self->_resources });
+  Mojo::IOLoop->next_tick(sub { $self->_resources });
   Mojo::IOLoop->recurring(5 => sub { $self->_resources });
 }
 
@@ -231,11 +231,11 @@
 
 my ($DECODER, $ENCODER) = (get_sereal_decoder, get_sereal_encoder);
 
-sub DESTROY { shift->{share}->unlock }
+sub DESTROY { flock shift->{fh}, LOCK_UN }
 
 sub new {
   my $self = shift->SUPER::new(@_);
-  $self->{share}->lock(LOCK_EX);
+  flock $self->{fh}, LOCK_EX;
   return $self;
 }
 
@@ -247,11 +247,16 @@
 }
 
 sub _fetch {
-  return {} unless my $data = shift->{share}->fetch;
-  return $DECODER->decode($data);
+  my $self = shift;
+  return $DECODER->decode(${$self->{map}});
 }
 
-sub _store { shift->{share}->store($ENCODER->encode(shift)) }
+sub _store {
+  my ($self, $data) = @_;
+  my $bytes = $ENCODER->encode($data);
+  return if length $bytes > length ${$self->{map}};
+  substr ${$self->{map}}, 0, length $bytes, $bytes;
+}
 
 1;
 
@@ -293,9 +298,8 @@
 
 L<Mojolicious::Plugin::Status> is a L<Mojolicious> plugin providing a server
 status ui for L<Mojo::Server::Daemon> and L<Mojo::Server::Prefork>. Note that
-this module is B<EXPERIMENTAL> because the IPC mechanism used can be unreliable
-and slow down the whole application significantly. Therefore it should 
currently
-only be used for debugging purposes.
+this module is B<EXPERIMENTAL> and should therefore only be used for debugging
+purposes.
 
 =head1 OPTIONS
 
@@ -317,12 +321,13 @@
 L<Mojolicious::Routes::Route> object to attach the server status ui to, 
defaults
 to generating a new one with the prefix C</mojo-status>.
 
-=head2 shm_key
+=head2 size
 
   # Mojolicious::Lite
-  plugin Status => {shm_key => 1234};
+  plugin Status => {size => 1234};
 
-Shared memory key to use with L<IPC::ShareLite>, defaults to C<1234>.
+Size of anonymous mapped memory to use for storing statistics, defaults to
+C<52428800> (50 MiB).
 
 =head1 METHODS
 
@@ -366,7 +371,7 @@
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2018, Sebastian Riedel and others.
+Copyright (C) 2018-2020, Sebastian Riedel and others.
 
 This program is free software, you can redistribute it and/or modify it under
 the terms of the Artistic License version 2.0.


Reply via email to