the browser-facing portion of osu!
at master 44 lines 1.0 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace App\Jobs; 7 8use App\Models\BeatmapDiscussion; 9use Illuminate\Bus\Queueable; 10use Illuminate\Contracts\Queue\ShouldQueue; 11 12class RefreshBeatmapsetUserKudosu implements ShouldQueue 13{ 14 use Queueable; 15 16 protected $beatmapsetId; 17 protected $userId; 18 19 /** 20 * Create a new job instance. 21 * 22 * @return void 23 */ 24 public function __construct($params) 25 { 26 $this->beatmapsetId = $params['beatmapsetId']; 27 $this->userId = $params['userId']; 28 } 29 30 /** 31 * Execute the job. 32 * 33 * @return void 34 */ 35 public function handle() 36 { 37 BeatmapDiscussion 38 ::where('beatmapset_id', $this->beatmapsetId) 39 ->where('user_id', $this->userId) 40 ->chunkById(1000, function ($chunk) { 41 $chunk->each->refreshKudosu('recalculate'); 42 }); 43 } 44}