Skip to content

Commit c6cdae2

Browse files
authored
Merge pull request #2 from DevDavido/development
Bump to v1.0.1
2 parents e0b8eac + 13deeb9 commit c6cdae2

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# Changelog
22

3+
## 1.0.1
4+
- Fixed: Made sure tasks aren't executed concurrently
5+
- Fixed: composer.json is compatible with Composer v2 now
6+
37
## 1.0
48
- Initial release

Tasks.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public function schedule()
6767
*/
6868
public function auditSite(int $idSite)
6969
{
70-
if ($this->hasTaskStartedToday($idSite)) {
71-
Log::info('Performance Audit task for site ' . $idSite . ' has been already started today');
70+
if ($this->hasAnyTaskStartedToday()) {
71+
Log::info('Performance Audit tasks have been already started today');
7272
return;
7373
}
7474
Log::info('Performance Audit task for site ' . $idSite . ' will be started now');
@@ -89,6 +89,21 @@ public function auditSite(int $idSite)
8989
Log::info('Performance Audit task for site ' . $idSite . ' has finished');
9090
}
9191

92+
/**
93+
* Check if any task has started today.
94+
*
95+
* @return bool
96+
* @throws Exception
97+
*/
98+
private function hasAnyTaskStartedToday()
99+
{
100+
$tasksStartedToday = array_map(function($site) {
101+
return $this->hasTaskStartedToday((int) $site['idsite']);
102+
}, Site::getSites());
103+
104+
return in_array(true, $tasksStartedToday);
105+
}
106+
92107
/**
93108
* Check if this task has started today.
94109
*

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "DevDavido/performance-audit-plugin",
2+
"name": "devdavido/performance-audit-plugin",
33
"type": "project",
44
"license": "GPL-3.0-only",
55
"authors": [

0 commit comments

Comments
 (0)