Skip to content

Commit

Permalink
Merge pull request #10886 from nanaya/configurable-processing-queue
Browse files Browse the repository at this point in the history
Configurable score processing queue
  • Loading branch information
notbakaneko authored Jan 24, 2024
2 parents 5e792d1 + 7b7c153 commit 57b36f5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ CLIENT_CHECK_VERSION=false
# SCORES_ES_CACHE_DURATION=
# SCORES_EXPERIMENTAL_RANK_AS_DEFAULT=false
# SCORES_EXPERIMENTAL_RANK_AS_EXTRA=false
# SCORES_PROCESSING_QUEUE=osu-queue:score-statistics
# SCORES_RANK_CACHE_LOCAL_SERVER=0
# SCORES_RANK_CACHE_MIN_USERS=35000
# SCORES_RANK_CACHE_SERVER_URL=
Expand Down
4 changes: 1 addition & 3 deletions app/Models/Solo/Score.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class Score extends Model implements Traits\ReportableInterface
{
use Traits\Reportable, Traits\WithWeightedPp;

const PROCESSING_QUEUE = 'osu-queue:score-statistics';

public $timestamps = false;

protected $casts = [
Expand Down Expand Up @@ -101,7 +99,7 @@ public static function extractParams(array $params, ScoreToken|MultiplayerScoreL
*/
public static function queueForProcessing(array $scoreJson): void
{
LaravelRedis::lpush(static::PROCESSING_QUEUE, json_encode([
LaravelRedis::lpush($GLOBALS['cfg']['osu']['scores']['processing_queue'], json_encode([
'Score' => [
'beatmap_id' => $scoreJson['beatmap_id'],
'id' => $scoreJson['id'],
Expand Down
1 change: 1 addition & 0 deletions config/osu.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
'es_cache_duration' => 60 * (get_float(env('SCORES_ES_CACHE_DURATION')) ?? 0.5), // in minutes, converted to seconds
'experimental_rank_as_default' => get_bool(env('SCORES_EXPERIMENTAL_RANK_AS_DEFAULT')) ?? false,
'experimental_rank_as_extra' => get_bool(env('SCORES_EXPERIMENTAL_RANK_AS_EXTRA')) ?? false,
'processing_queue' => presence(env('SCORES_PROCESSING_QUEUE')) ?? 'osu-queue:score-statistics',
'rank_cache' => [
'local_server' => get_bool(env('SCORES_RANK_CACHE_LOCAL_SERVER')) ?? false,
'min_users' => get_int(env('SCORES_RANK_CACHE_MIN_USERS')) ?? 35000,
Expand Down
4 changes: 2 additions & 2 deletions tests/Controllers/Solo/ScoresControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ public function tearDown(): void
parent::tearDown();

static::createApp();
LaravelRedis::del(Score::PROCESSING_QUEUE);
LaravelRedis::del($GLOBALS['cfg']['osu']['scores']['processing_queue']);
}

private function processingQueueCount(): int
{
return LaravelRedis::llen(Score::PROCESSING_QUEUE);
return LaravelRedis::llen($GLOBALS['cfg']['osu']['scores']['processing_queue']);
}
}

0 comments on commit 57b36f5

Please sign in to comment.