Skip to content

Commit 4891cbd

Browse files
committed
added a parameter to customise a lock name for the aggregating jobs script
1 parent 08a237c commit 4891cbd

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
There are next changes:
66

7+
## 1.2.10
8+
9+
There are next changes:
10+
11+
- added a parameter to customise a lock name for the aggregating jobs script
12+
713
## 1.2.9
814

915
There are next changes:

src/Badoo/LiveProfilerUI/ConsoleCommands/ProcessAggregatingJobsCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ protected function configure()
2828
*/
2929
protected function execute(InputInterface $input, OutputInterface $output)
3030
{
31-
$lock_filename = '/tmp/aggregator_processor.lock';
31+
$output->writeln($this->getName() . ' started');
32+
33+
$App = new \Badoo\LiveProfilerUI\LiveProfilerUI();
34+
35+
$lock_filename = $App->getAggregatingJobsLockFile();
3236
!file_exists($lock_filename) && touch($lock_filename);
3337
$lock_fp = fopen($lock_filename, 'rb+');
3438
if (!flock($lock_fp, LOCK_EX | LOCK_NB)) {
@@ -38,10 +42,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
3842

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

41-
$output->writeln($this->getName() . ' started');
42-
43-
$App = new \Badoo\LiveProfilerUI\LiveProfilerUI();
44-
4545
$JobStorage = $App->getJobDataProvider();
4646

4747
$started_ts = time();

src/Badoo/LiveProfilerUI/LiveProfilerUI.php

+9
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,13 @@ public function isUseJobsInAggregation() : bool
170170
{
171171
return (bool)$this->getContainer()->getParameter('aggregator.use_jobs_in_aggregation');
172172
}
173+
174+
/**
175+
* @return string
176+
* @throws \Exception
177+
*/
178+
public function getAggregatingJobsLockFile() : string
179+
{
180+
return (string)$this->getContainer()->getParameter('aggregator.aggregating_jobs_lock_file');
181+
}
173182
}

src/config/services.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ parameters:
77
aggregator.use_layout: true
88
aggregator.log_file: ''
99
aggregator.minimum_profiles_count: 0
10+
aggregator.aggregating_jobs_lock_file: /app/db_data/aggregator_processor.lock
1011

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

0 commit comments

Comments
 (0)