diff options
| author | horus | 2022-01-03 14:55:54 +0100 |
|---|---|---|
| committer | horus | 2022-01-03 14:55:54 +0100 |
| commit | 0f94ba96bd39e48f5f7720ee62b028e2584ff96d (patch) | |
| tree | f87f189f9cca1701eb6cc62afae0159ecab7034f | |
| parent | 536b38a27f5ca16e40eb3de4d1fd8e6f1d25e924 (diff) | |
| download | senpai-0f94ba96bd39e48f5f7720ee62b028e2584ff96d.tar.gz | |
Add queue monitor
| -rw-r--r-- | composer.json | 1 | ||||
| -rw-r--r-- | composer.lock | 120 | ||||
| -rw-r--r-- | config/queue-monitor.php | 31 | ||||
| -rw-r--r-- | database/migrations/2018_02_05_000000_create_queue_monitor_table.php | 53 | ||||
| -rw-r--r-- | database/migrations/2021_02_28_172947_create_jobs_table.php | 36 | ||||
| -rw-r--r-- | routes/web.php | 5 |
6 files changed, 239 insertions, 7 deletions
diff --git a/composer.json b/composer.json index fd0e35c..78f65ed 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "laravel/framework": "^7.28", "laravel/tinker": "^2.0", "nesbot/carbon": "^2.30", + "romanzipp/laravel-queue-monitor": "^2.0", "willwashburn/phpamo": "^1.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 45bd0e7..d4f55e0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "436dc9f95ba32317f801635bff204772", + "content-hash": "6262a87577e295d565db2c1f5e1d9544", "packages": [ { "name": "brick/math", @@ -781,19 +781,20 @@ }, { "name": "jikan-me/jikan", - "version": "v2.16.17", + "version": "v2.18.13", "source": { "type": "git", "url": "https://github.com/jikan-me/jikan.git", - "reference": "25a353edc28024cadab40bf81bdddc2bad12717c" + "reference": "d41c4535bb739824c61ae22192c41eb3b705399c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jikan-me/jikan/zipball/25a353edc28024cadab40bf81bdddc2bad12717c", - "reference": "25a353edc28024cadab40bf81bdddc2bad12717c", + "url": "https://api.github.com/repos/jikan-me/jikan/zipball/d41c4535bb739824c61ae22192c41eb3b705399c", + "reference": "d41c4535bb739824c61ae22192c41eb3b705399c", "shasum": "" }, "require": { + "ext-json": "*", "fabpot/goutte": "^3.2", "php": "^7.1" }, @@ -830,7 +831,7 @@ "description": "Jikan is an unofficial MyAnimeList API", "support": { "issues": "https://github.com/jikan-me/jikan/issues", - "source": "https://github.com/jikan-me/jikan/tree/v2.16.17" + "source": "https://github.com/jikan-me/jikan/tree/v2.18.13" }, "funding": [ { @@ -838,7 +839,7 @@ "type": "patreon" } ], - "time": "2021-01-10T20:02:55+00:00" + "time": "2022-01-02T21:01:41+00:00" }, { "name": "laravel/framework", @@ -2243,6 +2244,111 @@ "time": "2020-08-18T17:17:46+00:00" }, { + "name": "romanzipp/laravel-queue-monitor", + "version": "2.0.23", + "source": { + "type": "git", + "url": "https://github.com/romanzipp/Laravel-Queue-Monitor.git", + "reference": "6ff700985a01c457f81d76117feae31bbb5156a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/romanzipp/Laravel-Queue-Monitor/zipball/6ff700985a01c457f81d76117feae31bbb5156a5", + "reference": "6ff700985a01c457f81d76117feae31bbb5156a5", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "illuminate/queue": "^5.5|^6.0|^7.0|^8.0", + "illuminate/support": "^5.5|^6.0|^7.0|^8.0", + "php": "^7.2|^8.0", + "romanzipp/php-cs-fixer-config": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.17", + "laravel/framework": "^5.5|^6.0|^7.0|^8.0", + "mockery/mockery": "^1.3.2", + "orchestra/testbench": "^3.8|^4.0|^5.0|^6.0", + "phpunit/phpunit": "^8.0|^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "romanzipp\\QueueMonitor\\Providers\\QueueMonitorProvider" + ] + } + }, + "autoload": { + "psr-4": { + "romanzipp\\QueueMonitor\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "romanzipp", + "email": "ich@ich.wtf", + "homepage": "https://ich.wtf" + } + ], + "description": "Queue Monitoring for Laravel Database Job Queue", + "support": { + "issues": "https://github.com/romanzipp/Laravel-Queue-Monitor/issues", + "source": "https://github.com/romanzipp/Laravel-Queue-Monitor/tree/2.0.23" + }, + "time": "2021-01-15T19:47:23+00:00" + }, + { + "name": "romanzipp/php-cs-fixer-config", + "version": "1.0.10", + "source": { + "type": "git", + "url": "https://github.com/romanzipp/PHP-CS-Fixer-Config.git", + "reference": "96053962b762d99c547fef475fe77f7929f1b927" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/romanzipp/PHP-CS-Fixer-Config/zipball/96053962b762d99c547fef475fe77f7929f1b927", + "reference": "96053962b762d99c547fef475fe77f7929f1b927", + "shasum": "" + }, + "require": { + "php": "^7.1|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.12", + "phpunit/phpunit": "^7.0|^8.0|^9.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "romanzipp\\Fixer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "romanzipp", + "email": "ich@ich.wtf", + "homepage": "https://ich.wtf" + } + ], + "description": "Personal PHP-CS-Fixer Configuration", + "support": { + "issues": "https://github.com/romanzipp/PHP-CS-Fixer-Config/issues", + "source": "https://github.com/romanzipp/PHP-CS-Fixer-Config/tree/1.0.10" + }, + "time": "2021-02-03T16:44:14+00:00" + }, + { "name": "swiftmailer/swiftmailer", "version": "v6.2.4", "source": { diff --git a/config/queue-monitor.php b/config/queue-monitor.php new file mode 100644 index 0000000..aec12cd --- /dev/null +++ b/config/queue-monitor.php @@ -0,0 +1,31 @@ +<?php + +return [ + /* + * Set the table to be used for monitoring data. + */ + 'table' => 'queue_monitor', + + /* + * Set the model used for monitoring. + * If using a custom model, be sure to implement the + * romanzipp\QueueMonitor\Models\Contracts\MonitorContract + * interface or extend the base model. + */ + 'model' => \romanzipp\QueueMonitor\Models\Monitor::class, + + /* + * The optional UI settings. + */ + 'ui' => [ + /* + * Set the monitored jobs count to be displayed per page. + */ + 'per_page' => 35, + + /* + * Show custom data stored on model + */ + 'show_custom_data' => true, + ], +]; diff --git a/database/migrations/2018_02_05_000000_create_queue_monitor_table.php b/database/migrations/2018_02_05_000000_create_queue_monitor_table.php new file mode 100644 index 0000000..3115319 --- /dev/null +++ b/database/migrations/2018_02_05_000000_create_queue_monitor_table.php @@ -0,0 +1,53 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateQueueMonitorTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create(config('queue-monitor.table'), function (Blueprint $table) { + $table->increments('id'); + + $table->string('job_id')->index(); + $table->string('name')->nullable(); + $table->string('queue')->nullable(); + + $table->timestamp('started_at')->nullable()->index(); + $table->string('started_at_exact')->nullable(); + + $table->timestamp('finished_at')->nullable(); + $table->string('finished_at_exact')->nullable(); + + $table->float('time_elapsed', 12, 6)->nullable()->index(); + + $table->boolean('failed')->default(false)->index(); + + $table->integer('attempt')->default(0); + $table->integer('progress')->nullable(); + + $table->longText('exception')->nullable(); + $table->text('exception_message')->nullable(); + $table->text('exception_class')->nullable(); + + $table->longText('data')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop(config('queue-monitor.table')); + } +} diff --git a/database/migrations/2021_02_28_172947_create_jobs_table.php b/database/migrations/2021_02_28_172947_create_jobs_table.php new file mode 100644 index 0000000..1be9e8a --- /dev/null +++ b/database/migrations/2021_02_28_172947_create_jobs_table.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +class CreateJobsTable extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('jobs', function (Blueprint $table) { + $table->bigIncrements('id'); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedTinyInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('jobs'); + } +} diff --git a/routes/web.php b/routes/web.php index bd37c46..34f966e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -29,6 +29,11 @@ Route::get('/changeSeason', 'AnimeController@changeSeason')->name('change_season Route::get('/ical/{username}', 'IndexController@ical'); Route::get('/create/user/{param}', 'IndexController@createUser'); +Route::get('/_create/user/{param}', 'IndexController@_createUser'); +Route::prefix('jobs')->group(function () { + Route::queueMonitor(); +}); +#Route::get('/status/{param}', 'IndexController@showJobStatus'); Route::get('/save', 'IndexController@saveWatchingAnime'); Route::get('/test/getcal/{username}', 'TestController@getCalendar'); Route::get('/test/setcal/{username}', 'TestController@setCalendar'); |
