Skip to content

Commit

Permalink
added a parameter to customise a lock name for the aggregating jobs s…
Browse files Browse the repository at this point in the history
…cript
  • Loading branch information
shagtv committed Jan 15, 2020
1 parent 08a237c commit 4891cbd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

There are next changes:

## 1.2.10

There are next changes:

- added a parameter to customise a lock name for the aggregating jobs script

## 1.2.9

There are next changes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$lock_filename = '/tmp/aggregator_processor.lock';
$output->writeln($this->getName() . ' started');

$App = new \Badoo\LiveProfilerUI\LiveProfilerUI();

$lock_filename = $App->getAggregatingJobsLockFile();
!file_exists($lock_filename) && touch($lock_filename);
$lock_fp = fopen($lock_filename, 'rb+');
if (!flock($lock_fp, LOCK_EX | LOCK_NB)) {
Expand All @@ -38,10 +42,6 @@ protected function execute(InputInterface $input, OutputInterface $output)

ini_set('memory_limit', '1G');

$output->writeln($this->getName() . ' started');

$App = new \Badoo\LiveProfilerUI\LiveProfilerUI();

$JobStorage = $App->getJobDataProvider();

$started_ts = time();
Expand Down
9 changes: 9 additions & 0 deletions src/Badoo/LiveProfilerUI/LiveProfilerUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,13 @@ public function isUseJobsInAggregation() : bool
{
return (bool)$this->getContainer()->getParameter('aggregator.use_jobs_in_aggregation');
}

/**
* @return string
* @throws \Exception
*/
public function getAggregatingJobsLockFile() : string
{
return (string)$this->getContainer()->getParameter('aggregator.aggregating_jobs_lock_file');
}
}
1 change: 1 addition & 0 deletions src/config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ parameters:
aggregator.use_layout: true
aggregator.log_file: ''
aggregator.minimum_profiles_count: 0
aggregator.aggregating_jobs_lock_file: /app/db_data/aggregator_processor.lock

aggregator.fields_descriptions:
ct: Average calls count in this context during specified day (µs)
Expand Down

0 comments on commit 4891cbd

Please sign in to comment.