-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[235] Auto calculate the amount of concurrent processes for the broker.
- Loading branch information
1 parent
4c15ee5
commit 97ec48a
Showing
5 changed files
with
266 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Draw\Component\Messenger\Counter; | ||
|
||
use Fidry\CpuCoreCounter\CpuCoreCounter; | ||
use Fidry\CpuCoreCounter\NumberOfCpuCoreNotFound; | ||
|
||
class CpuCounter | ||
{ | ||
public function count(): int | ||
{ | ||
if (!class_exists(CpuCoreCounter::class) || !class_exists(NumberOfCpuCoreNotFound::class)) { | ||
throw new \RuntimeException('"fidry/cpu-core-counter" must be installed'); | ||
} | ||
|
||
$counter = new CpuCoreCounter(); | ||
|
||
try { | ||
return $counter->getCount(); | ||
} catch (NumberOfCpuCoreNotFound) { | ||
return 1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters