<commit_before><?php

/*
 * This file is part of HeriJobQueueBundle.
 *
 * (c) <NAME>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Heri\JobQueueBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class QueueCommand extends ContainerAwareCommand
{
    protected
        $client,
        $input;
    
    protected function configure()
    {
        $this
            ->setName('jobqueue:load')
            ->setDescription('Initialize JobQueue manager')
        ;
    }
    
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queue  = $this->getContainer()->get('jobqueue');
        $config = $this->getContainer()->getParameter('jobqueue.config');
        $em = $this->getContainer()->get('doctrine.orm.entity_manager');
        
        if ($config['enabled']) {
            do {
                foreach ($config['queues'] as $name) {
                    $queue->configure($name, $em);
                    $queue->receive($config['max_messages'], $this, $output);
                }
                sleep(1);
            } while (true);
        } else {
            $output->writeLn('<comment>JobQueue manager deactivated</comment>');
        }
    }
}<commit_msg>[Command] added a comment for listening<commit_after><?php

/*
 * This file is part of HeriJobQueueBundle.
 *
 * (c) <NAME>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Heri\JobQueueBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class QueueCommand extends ContainerAwareCommand
{
    protected
        $client,
        $input;
    
    protected function configure()
    {
        $this
            ->setName('jobqueue:load')
            ->setDescription('Initialize JobQueue manager')
        ;
    }
    
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queue  = $this->getContainer()->get('jobqueue');
        $config = $this->getContainer()->getParameter('jobqueue.config');
        $em = $this->getContainer()->get('doctrine.orm.entity_manager');
        
        if ($config['enabled']) {
            $output->writeLn('<info>JobQueue running... press ctrl-c to stop.</info>');
            do {
                foreach ($config['queues'] as $name) {
                    $queue->configure($name, $em);
                    $queue->receive($config['max_messages'], $this, $output);
                }
                sleep(1);
            } while (true);
        } else {
            $output->writeLn('<comment>JobQueue manager deactivated</comment>');
        }
    }
}
{'fraction_non_alphanumeric': 0.1232834909978639, 'fraction_numerical': 0.0006103143118706134, 'mean_word_length': 2.232741617357002, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2724852', 'n_tokens_mistral': 893, 'n_tokens_neox': 860, 'n_words': 185}