File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,8 @@ public function schedule()
67
67
*/
68
68
public function auditSite (int $ idSite )
69
69
{
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 ' );
72
72
return ;
73
73
}
74
74
Log::info ('Performance Audit task for site ' . $ idSite . ' will be started now ' );
@@ -89,6 +89,21 @@ public function auditSite(int $idSite)
89
89
Log::info ('Performance Audit task for site ' . $ idSite . ' has finished ' );
90
90
}
91
91
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
+
92
107
/**
93
108
* Check if this task has started today.
94
109
*
You can’t perform that action at this time.
0 commit comments