mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-11-27 05:39:55 +08:00
Push notifications to queue (fix #78)
This commit is contained in:
parent
2eb4f4e2d4
commit
4529d1e219
@ -66,7 +66,7 @@ MAIL_ENCRYPTION = null
|
||||
# Change below lines only if you know what they mean!
|
||||
CACHE_DRIVER = file
|
||||
SESSION_DRIVER = file
|
||||
QUEUE_DRIVER = sync
|
||||
QUEUE_DRIVER = database
|
||||
|
||||
REDIS_HOST = 127.0.0.1
|
||||
REDIS_PASSWORD = null
|
||||
|
@ -4,10 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class SiteMessage extends Notification
|
||||
class SiteMessage extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public $title;
|
||||
|
||||
public $content;
|
||||
|
@ -50,8 +50,11 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
try {
|
||||
if (option('enable_redis') && Redis::ping()) {
|
||||
config(['cache.default' => 'redis']);
|
||||
config(['session.driver' => 'redis']);
|
||||
config([
|
||||
'cache.default' => 'redis',
|
||||
'session.driver' => 'redis',
|
||||
'queue.default' => 'redis',
|
||||
]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
//
|
||||
|
@ -15,7 +15,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_DRIVER', 'sync'),
|
||||
'default' => env('QUEUE_DRIVER', 'database'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
36
database/migrations/2019_07_05_222912_create_jobs_table.php
Normal file
36
database/migrations/2019_07_05_222912_create_jobs_table.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
10
database/update_scripts/update-4.3.6-to-4.3.7.php
Normal file
10
database/update_scripts/update-4.3.6-to-4.3.7.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'请您手动打开终端或 PowerShell 执行以下命令以完成升级:',
|
||||
'Please open terminal or PowerShell to complete upgrade:',
|
||||
'<code>php artisan migrate --force</code>',
|
||||
'',
|
||||
'然后修改 .env 文件,将 <code>QUEUE_DRIVER</code> 的值改为 <code>database</code>。(使用 Redis 的用户请修改为 <code>redis</code>)',
|
||||
'Then, please edit your ".env" file. Change the value of <code>QUEUE_DRIVER</code> from <code>sync</code> to <code>database</code>. Redis users please change it to <code>redis</code>.',
|
||||
];
|
3
resources/misc/changelogs/en/4.3.7.md
Normal file
3
resources/misc/changelogs/en/4.3.7.md
Normal file
@ -0,0 +1,3 @@
|
||||
## Tweaked
|
||||
|
||||
- Push notifications to queue for performance.
|
3
resources/misc/changelogs/zh_CN/4.3.7.md
Normal file
3
resources/misc/changelogs/zh_CN/4.3.7.md
Normal file
@ -0,0 +1,3 @@
|
||||
## 调整
|
||||
|
||||
- 发送通知时将任务推送到队列
|
@ -41,6 +41,7 @@ class SetupControllerTest extends TestCase
|
||||
'oauth_personal_access_clients',
|
||||
'oauth_refresh_tokens',
|
||||
'notifications',
|
||||
'jobs',
|
||||
];
|
||||
array_walk($tables, function ($table) {
|
||||
Schema::dropIfExists($table);
|
||||
|
Loading…
Reference in New Issue
Block a user