From 56f67022f26164779f53113b23da804304ad4cdc Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 26 Nov 2021 11:28:04 +0000 Subject: [PATCH] drop WorkQueue (abandoned idea) --- lib/App/MPD/Feeder.pm | 1 - lib/App/MPD/Feeder/WorkQueue.pm | 48 --------------------------------- 2 files changed, 49 deletions(-) delete mode 100644 lib/App/MPD/Feeder/WorkQueue.pm diff --git a/lib/App/MPD/Feeder.pm b/lib/App/MPD/Feeder.pm index 36bf29d..bead4f2 100644 --- a/lib/App/MPD/Feeder.pm +++ b/lib/App/MPD/Feeder.pm @@ -5,7 +5,6 @@ class App::MPD::Feeder; use App::MPD::Feeder::DB; use App::MPD::Feeder::Options; -use App::MPD::Feeder::WorkQueue; use DBD::Pg; use DBI; use Getopt::Long; diff --git a/lib/App/MPD/Feeder/WorkQueue.pm b/lib/App/MPD/Feeder/WorkQueue.pm deleted file mode 100644 index aa21fb0..0000000 --- a/lib/App/MPD/Feeder/WorkQueue.pm +++ /dev/null @@ -1,48 +0,0 @@ -use v5.28; -use utf8; -use Object::Pad; -class App::MPD::Feeder::WorkQueue; - -use Log::Any qw($log); - -has @queue; -has %present; - -method add($key) { - if ( exists $present{$key} ) { - $log->trace("job '$key' already queued"); - } - else { - $present{$key} = undef; - push @queue, $key; - - $log->trace("job '$key' queued"); - } -} - -method next { - my $item = shift @queue; - - if ( defined($item) ) { - $log->trace("next job: '$item'"); - delete $present{$item}; - } - else { - $log->trace("job queue is empty"); - } - - return $item; -} - -method clear { - @queue = (); - %present = (); - $log->trace('work queue cleared'); -} - -method has_jobs { - $log->trace( "Queue jobs: " . scalar(@queue) ); - return scalar @queue; -} - -1; -- 2.39.5