App-Environ-Que

 view release on metacpan or  search on metacpan

lib/App/Environ/Que.pm  view on Meta::CPAN

our $VERSION = '0.1';

use strict;
use warnings;
use v5.10;
use utf8;

use App::Environ;
use App::Environ::Mojo::Pg;
use Carp qw(croak);
use Cpanel::JSON::XS;
use Params::Validate qw( validate_pos validate );

my $INSTANCE;

my $sql = q{
  INSERT INTO public.que_jobs
  ( queue, priority, run_at, job_class, args )
  VALUES  (
    coalesce(?::text, ''::text),
    coalesce(?::smallint, 100::smallint),

lib/App/Environ/Que.pm  view on Meta::CPAN

    queue    => 0,
    priority => 0,
    run_at   => 0,
    type     => 1,
    args     => 0,
  }
);

App::Environ->register( __PACKAGE__, postfork => sub { undef $INSTANCE } );

my $JSON = Cpanel::JSON::XS->new;

sub instance {
  my $class = shift;

  my ($connector) = validate_pos( @_, 1 );

  unless ($INSTANCE) {
    my $pg = App::Environ::Mojo::Pg->pg($connector);
    $INSTANCE = bless { pg => $pg }, $class;
  }



( run in 0.497 second using v1.01-cache-2.11-cpan-4d50c553e7e )