Add guard to prevent mass score fetching of users we don't really care about
This commit is contained in:
parent
dc846854e4
commit
02b41bae0d
@ -162,7 +162,13 @@ class ImportScores(
|
||||
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())
|
||||
|
||||
if (user == null) {
|
||||
@ -173,7 +179,7 @@ class ImportScores(
|
||||
|
||||
var userScores = mutableListOf<OsuApiModels.Score>()
|
||||
|
||||
if (user.beatmap_playcounts_count != null) {
|
||||
if (shouldFullFetch && user.beatmap_playcounts_count != null) {
|
||||
val mapsPlayed: MutableSet<Int> = mutableSetOf()
|
||||
|
||||
this.logger.info("User has ${user.beatmap_playcounts_count} unique beatmap plays")
|
||||
|
||||
@ -79,12 +79,11 @@ class UpdateUserQueueService(
|
||||
/**
|
||||
* Retrieves the full update queue, only pending users.
|
||||
*/
|
||||
fun getQueue(): List<Long> {
|
||||
return dslContext.select(UPDATE_USER_QUEUE.USER_ID)
|
||||
.from(UPDATE_USER_QUEUE)
|
||||
fun getQueue(): List<UpdateUserQueueRecord> {
|
||||
return dslContext.selectFrom(UPDATE_USER_QUEUE)
|
||||
.where(UPDATE_USER_QUEUE.PROCESSED.isFalse)
|
||||
.orderBy(UPDATE_USER_QUEUE.CREATED_AT.asc())
|
||||
.fetchInto(Long::class.java)
|
||||
.fetch()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user