SHA256
8
0
forked from pool/perl-Minion
Files
perl-Minion/perl-Minion.spec

106 lines
3.4 KiB
RPMSpec
Raw Normal View History

#
# spec file for package perl-Minion
#
# Copyright (c) 2015 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Minion
Version: 4.01
Release: 0
%define cpan_name Minion
Summary: Job queue
License: Artistic-2.0
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Minion/
Source0: http://www.cpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(Mojolicious) >= 6.0
Requires: perl(Mojolicious) >= 6.0
%{perl_requires}
%description
Minion is a job queue for the Mojolicious|http://mojolicio.us real-time web
framework with support for multiple named queues, priorities, delayed jobs,
job results, retries with backoff, distributed workers, parallel processing
and multiple backends (such as PostgreSQL|http://www.postgresql.org).
A job queue allows you to process time and/or computationally intensive
tasks in background processes, outside of the request/response lifecycle.
Among those tasks you'll commonly find image resizing, spam filtering, HTTP
downloads, building tarballs, warming caches and basically everything else
you can imagine that's not super fast.
use Mojolicious::Lite;
plugin Minion => {Pg => 'postgresql://sri:s3cret@localhost/test'};
# Slow task
app->minion->add_task(poke_mojo => sub {
my $job = shift;
$job->app->ua->get('mojolicio.us');
$job->app->log->debug('We have poked mojolicio.us for a visitor');
});
# Perform job in a background worker process
get '/' => sub {
my $c = shift;
$c->minion->enqueue('poke_mojo');
$c->render(text => 'We will poke mojolicio.us for you soon.');
};
app->start;
Background worker processes are usually started with the command
Minion::Command::minion::worker, which becomes automatically available when
an application loads the plugin Mojolicious::Plugin::Minion.
$ ./myapp.pl minion worker
Jobs can be managed right from the command line with
Minion::Command::minion::job.
$ ./myapp.pl minion job
Every job can fail or succeed, but not get lost, the system is eventually
consistent and will preserve job results for as long as you like, depending
on /"remove_after". While individual workers can fail in the middle of
processing a job, the system will detect this and ensure that no job is
left in an uncertain state, depending on /"missing_after".
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes CONTRIBUTING.md LICENSE README.md
%changelog