cPanel::TaskQueue

FIFO queue of tasks to perform
Download

cPanel::TaskQueue Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • cPanel Inc.
  • Publisher web site:
  • http://search.cpan.org/~cpanel/

cPanel::TaskQueue Tags


cPanel::TaskQueue Description

FIFO queue of tasks to perform cPanel::TaskQueue is a Perl module that provides an abstraction for a FIFO queue of tasks that may be executed asynchronously. Each command determines whether it runs in the current process or forks a child to do the work in the background.The TaskQueue has support for limiting the number of background tasks running at one time and for preventing duplicate tasks from being scheduled.SYNOPSIS use cPanel::TaskQueue (); my $queue = cPanel::TaskQueue->new( { name => 'tasks', cache_dir => "/home/$user/.cpanel/cache" } ); $queue->queue_task( "init_quota" ); $queue->queue_task( "edit_quota fred 0" ); # Processing loop while (1) { # if work, process, else sleep if ( $queue-has_work_to_do() ) { eval { $queue->process_next_task() }; if ( $@ ) { Carp::carp( $@ ); } } else { # wait for work. sleep 300; } } Requirements: · Perl


cPanel::TaskQueue Related Software