mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
improve horizon
This commit is contained in:
@@ -72,7 +72,7 @@ elif [ "$SERVICE_NAME" = "queue" ]; then
|
||||
while true; do
|
||||
if [ -f "$ENV_FILE" ] && [ -d "$VENDOR_DIR" ]; then
|
||||
echo_success "[Queue] Run queue:work at $(date '+%Y-%m-%d %H:%M:%S')";
|
||||
php artisan queue:horizon;
|
||||
php artisan horizon;
|
||||
else
|
||||
echo_info "[Queue] .env or vendor not exists,wait 5 seconds ...";
|
||||
sleep 5;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Jobs\SettleClaim;
|
||||
use App\Models\PluginStore;
|
||||
use App\Models\Setting;
|
||||
use App\Repositories\TokenRepository;
|
||||
@@ -31,16 +32,6 @@ class ToolController extends Controller
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
|
||||
public function test(Request $request)
|
||||
{
|
||||
$result = ['id' => 1];
|
||||
$result['permissions'] = TokenRepository::listUserTokenPermissionAllowed();
|
||||
// $result['permissions'] = Setting::getPermissionUserTokenAllowed();
|
||||
$resource = new JsonResource($result);
|
||||
return $this->success($resource);
|
||||
}
|
||||
|
||||
public function error(Request $request)
|
||||
{
|
||||
return view('error', ['error' => $request->query('error')]);
|
||||
|
||||
@@ -11,7 +11,7 @@ use Illuminate\Queue\SerializesModels;
|
||||
use Nexus\Database\NexusDB;
|
||||
use Nexus\Plugin\Plugin;
|
||||
|
||||
class MaintainPluginState implements ShouldQueue
|
||||
class MaintainPluginState
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ return [
|
||||
'defaults' => [
|
||||
'supervisor-1' => [
|
||||
'connection' => 'redis',
|
||||
'queue' => ['default'],
|
||||
'queue' => ['nexus_queue'],
|
||||
'balance' => 'auto',
|
||||
'autoScalingStrategy' => 'time',
|
||||
'maxProcesses' => 1,
|
||||
|
||||
@@ -209,9 +209,11 @@ function do_log($log, $level = 'info', $echo = false)
|
||||
}
|
||||
}
|
||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2);
|
||||
$dt = DateTime::createFromFormat('U.u', microtime(true));
|
||||
$dt->setTimezone(new DateTimeZone(nexus_env('TIMEZONE', 'UTC')));
|
||||
$content = sprintf(
|
||||
"[%s] [%s] [%s] [%s] [%s] [%s] %s.%s %s:%s %s%s%s %s%s",
|
||||
date('Y-m-d H:i:s'),
|
||||
$dt->format("Y-m-d\TH:i:s.vP"),
|
||||
nexus() ? nexus()->getRequestId() : 'NO_REQUEST_ID',
|
||||
nexus() ? nexus()->getLogSequence() : 0,
|
||||
sprintf('%.3f', microtime(true) - (nexus() ? nexus()->getStartTimestamp() : 0)),
|
||||
@@ -276,9 +278,7 @@ function getLogFile($append = '')
|
||||
$scriptUserInfo = posix_getpwuid(posix_getuid());
|
||||
$name .= sprintf("-cli-%s", $scriptUserInfo['name']);
|
||||
}
|
||||
if (IN_NEXUS) {
|
||||
$name .= "-" . date('Y-m-d');
|
||||
}
|
||||
$name .= "-" . date('Y-m-d');
|
||||
return $logFiles[$append] = $name . $suffix;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Schedule;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -17,3 +18,5 @@ use Illuminate\Support\Facades\Artisan;
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
Schedule::command('horizon:snapshot')->everyFiveMinutes();
|
||||
|
||||
@@ -35,8 +35,6 @@ if (!isRunningInConsole()) {
|
||||
}
|
||||
}
|
||||
|
||||
Route::get('test', [\App\Http\Controllers\ToolController::class, 'test'])->middleware(['web']);
|
||||
|
||||
Route::group(['prefix' => 'oauth'], function () {
|
||||
Route::get("user-info", [\App\Http\Controllers\OauthController::class, 'userInfo'])->name("oauth.user_info")->middleware('auth:api');
|
||||
Route::get('redirect/{uuid}', [\App\Http\Controllers\OauthController::class, 'redirect']);
|
||||
|
||||
Reference in New Issue
Block a user