added a help system, replaced the words "tenant" and "Pwa" with better alternatives. corrected and implemented cron jobs. prepared going live on a coolify-powered system.
This commit is contained in:
40
app/Console/Concerns/InteractsWithCacheLocks.php
Normal file
40
app/Console/Concerns/InteractsWithCacheLocks.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Concerns;
|
||||
|
||||
use Illuminate\Contracts\Cache\Lock;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
trait InteractsWithCacheLocks
|
||||
{
|
||||
/**
|
||||
* Attempt to acquire a cache-backed lock for the given command.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Cache\Lock|false|null Returns the lock when acquired, false if another process holds it, null if locks are unsupported.
|
||||
*/
|
||||
protected function acquireCommandLock(string $name, int $seconds, bool $force = false): Lock|false|null
|
||||
{
|
||||
try {
|
||||
$lock = Cache::lock($name, $seconds);
|
||||
|
||||
if ($force) {
|
||||
$lock->forceRelease();
|
||||
}
|
||||
|
||||
if ($lock->get()) {
|
||||
return $lock;
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (\BadMethodCallException $exception) {
|
||||
Log::channel('storage-jobs')->debug('Cache store does not support locks for command', [
|
||||
'lock' => $name,
|
||||
'store' => config('cache.default'),
|
||||
'exception' => $exception->getMessage(),
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user