Sync sansei branch #1

Merged
Stedos merged 34 commits from sansei into main 2025-02-24 21:12:28 +00:00
2 changed files with 11 additions and 6 deletions
Showing only changes of commit 02b41bae0d - Show all commits

View File

@ -162,7 +162,13 @@ class ImportScores(
this.logger.info("Processing ${queue.size} users from the queue.") this.logger.info("Processing ${queue.size} users from the queue.")
} }
for(userId in queue) { for(queueEntry in queue) {
val userId = queueEntry.userId
// We should only 'full fetch' a user if they have been explicitly added by another user,
// else we will spend way too much time on random users.
val shouldFullFetch = queueEntry.addedByUserId != null
val user = this.osuApi.getUserProfile(userId.toString()) val user = this.osuApi.getUserProfile(userId.toString())
if (user == null) { if (user == null) {
@ -173,7 +179,7 @@ class ImportScores(
var userScores = mutableListOf<OsuApiModels.Score>() var userScores = mutableListOf<OsuApiModels.Score>()
if (user.beatmap_playcounts_count != null) { if (shouldFullFetch && user.beatmap_playcounts_count != null) {
val mapsPlayed: MutableSet<Int> = mutableSetOf() val mapsPlayed: MutableSet<Int> = mutableSetOf()
this.logger.info("User has ${user.beatmap_playcounts_count} unique beatmap plays") this.logger.info("User has ${user.beatmap_playcounts_count} unique beatmap plays")

View File

@ -79,12 +79,11 @@ class UpdateUserQueueService(
/** /**
* Retrieves the full update queue, only pending users. * Retrieves the full update queue, only pending users.
*/ */
fun getQueue(): List<Long> { fun getQueue(): List<UpdateUserQueueRecord> {
return dslContext.select(UPDATE_USER_QUEUE.USER_ID) return dslContext.selectFrom(UPDATE_USER_QUEUE)
.from(UPDATE_USER_QUEUE)
.where(UPDATE_USER_QUEUE.PROCESSED.isFalse) .where(UPDATE_USER_QUEUE.PROCESSED.isFalse)
.orderBy(UPDATE_USER_QUEUE.CREATED_AT.asc()) .orderBy(UPDATE_USER_QUEUE.CREATED_AT.asc())
.fetchInto(Long::class.java) .fetch()
} }
/** /**