Compare commits
3 Commits
v1.0
...
7fbc1a364d
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fbc1a364d | |||
| 378b0f5e4b | |||
| e498990393 |
19
README.md
19
README.md
@@ -1,3 +1,22 @@
|
|||||||
# sprinkle-worker
|
# sprinkle-worker
|
||||||
|
|
||||||
"Background" worker sprinkle for userfrosting
|
"Background" worker sprinkle for userfrosting
|
||||||
|
|
||||||
|
The following snippit creates a single worker thread for processing tasks:
|
||||||
|
```
|
||||||
|
[Unit]
|
||||||
|
Description=UserFrosting workers service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Restart=on-failure
|
||||||
|
Type=simple
|
||||||
|
PIDFile=/run/uf-workers.pid
|
||||||
|
ExecStart=php bakery worker:run --quiet
|
||||||
|
WorkingDirectory=/srv/UserFrosting
|
||||||
|
User=www-data
|
||||||
|
Group=www-data
|
||||||
|
SyslogIdentifier=UF-worker
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
@@ -96,13 +96,18 @@ class JobInspector
|
|||||||
$basePath = str_replace($file->getBasename(), '', $file->getBasePath());
|
$basePath = str_replace($file->getBasename(), '', $file->getBasePath());
|
||||||
$name = $basePath . $file->getFilename();
|
$name = $basePath . $file->getFilename();
|
||||||
$className = str_replace('/', '\\', $basePath) . $file->getFilename();
|
$className = str_replace('/', '\\', $basePath) . $file->getFilename();
|
||||||
$classPath = "\\$sprinkleNS\\Worker\\Jobs\\$className";
|
$classPath = "\\$sprinkleNS\\Jobs\\$className";
|
||||||
|
|
||||||
// Exclude known helper classes
|
// Exclude known helper classes
|
||||||
if ($className == "JobInterface" || $className == "JobBase" || $className == "JobInspector") {
|
if ($className == "JobInterface" || $className == "JobBase" || $className == "JobInspector") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$reflect = new \ReflectionClass($classPath);
|
||||||
|
if ($reflect->isAbstract()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// Build the class name and namespace
|
// Build the class name and namespace
|
||||||
return [
|
return [
|
||||||
'sprinkle' => $sprinkleName,
|
'sprinkle' => $sprinkleName,
|
||||||
|
|||||||
Reference in New Issue
Block a user