mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-01-03 05:34:14 +00:00
Update configs
This commit is contained in:
parent
cf9f5f0bab
commit
0bc5f1306d
5 changed files with 27 additions and 23 deletions
|
@ -40,22 +40,20 @@ class CatchUnoptimizedMedia extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
DB::transaction(function() {
|
Media::whereNull('processed_at')
|
||||||
Media::whereNull('processed_at')
|
->where('created_at', '>', now()->subHours(1))
|
||||||
->where('skip_optimize', '!=', true)
|
->where('skip_optimize', '!=', true)
|
||||||
->whereNull('remote_url')
|
->whereNull('remote_url')
|
||||||
->whereNotNull('status_id')
|
->whereNotNull('status_id')
|
||||||
->whereNotNull('media_path')
|
->whereNotNull('media_path')
|
||||||
->where('created_at', '>', now()->subHours(1))
|
->whereIn('mime', [
|
||||||
->whereIn('mime', [
|
'image/jpeg',
|
||||||
'image/jpeg',
|
'image/png',
|
||||||
'image/png',
|
])
|
||||||
])
|
->chunk(50, function($medias) {
|
||||||
->chunk(50, function($medias) {
|
foreach ($medias as $media) {
|
||||||
foreach ($medias as $media) {
|
ImageOptimize::dispatch($media);
|
||||||
ImageOptimize::dispatch($media);
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace App\Console\Commands;
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use App\{Media, Status};
|
use App\{Media, Status};
|
||||||
use Carbon\Carbon;
|
|
||||||
use App\Services\MediaStorageService;
|
use App\Services\MediaStorageService;
|
||||||
|
|
||||||
class MediaGarbageCollector extends Command
|
class MediaGarbageCollector extends Command
|
||||||
|
@ -40,11 +39,10 @@ class MediaGarbageCollector extends Command
|
||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$limit = 20000;
|
$limit = 500;
|
||||||
|
|
||||||
$gc = Media::whereNull('status_id')
|
$gc = Media::whereNull('status_id')
|
||||||
->where('created_at', '<', Carbon::now()->subHours(12)->toDateTimeString())
|
->where('created_at', '<', now()->subHours(2)->toDateTimeString())
|
||||||
->orderBy('created_at','asc')
|
|
||||||
->take($limit)
|
->take($limit)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ class Kernel extends ConsoleKernel
|
||||||
*/
|
*/
|
||||||
protected function schedule(Schedule $schedule)
|
protected function schedule(Schedule $schedule)
|
||||||
{
|
{
|
||||||
$schedule->command('media:optimize')->hourly();
|
$schedule->command('media:optimize')->hourlyAt(40);
|
||||||
$schedule->command('media:gc')->hourly();
|
$schedule->command('media:gc')->hourlyAt(5);
|
||||||
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
$schedule->command('horizon:snapshot')->everyFiveMinutes();
|
||||||
$schedule->command('story:gc')->everyFiveMinutes();
|
$schedule->command('story:gc')->everyFiveMinutes();
|
||||||
$schedule->command('gc:failedjobs')->dailyAt(3);
|
$schedule->command('gc:failedjobs')->dailyAt(3);
|
||||||
|
|
|
@ -89,6 +89,12 @@ return [
|
||||||
'emergency' => [
|
'emergency' => [
|
||||||
'path' => storage_path('logs/laravel.log'),
|
'path' => storage_path('logs/laravel.log'),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'media' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/media.log'),
|
||||||
|
'level' => 'debug'
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
'delete_local_after_cloud' => env('MEDIA_DELETE_LOCAL_AFTER_CLOUD', true),
|
||||||
|
|
||||||
'exif' => [
|
'exif' => [
|
||||||
'database' => env('MEDIA_EXIF_DATABASE', false),
|
'database' => env('MEDIA_EXIF_DATABASE', false),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in a new issue