Skip to content

Commit

Permalink
Fix chunking, update pgsql
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Oct 22, 2024
1 parent e1bd733 commit 025a230
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies {
implementation("com.ibm.icu:icu4j:71.1")

// Database
implementation("org.postgresql:postgresql:42.3.3")
implementation("org.postgresql:postgresql:42.7.4")
implementation("com.zaxxer:HikariCP:5.0.1")
implementation("org.jetbrains.exposed:exposed-core:0.55.0")
implementation("org.jetbrains.exposed:exposed-dao:0.55.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class CheckDupeClientIds(val helper: LorittaHelper) : RunnableCoroutine {
val alreadyChecked = mutableSetOf<Long>()
val usersToBeBanned = mutableListOf<BannedUser>()

allClientIds.chunked(65_535).forEach { clientIds ->
// We can't actually chunk by 65_535 because it is ALL PARAMETERS of the query (every client ID + the subquery)
allClientIds.chunked(65_530).forEach { clientIds ->
val clientIdsThatAreBanned = Dailies
.innerJoin(BrowserFingerprints)
.innerJoin(BannedUsers, { Dailies.receivedById }, { BannedUsers.userId })
Expand All @@ -82,7 +83,7 @@ class CheckDupeClientIds(val helper: LorittaHelper) : RunnableCoroutine {
BrowserFingerprints.clientId inList clientIds and (BannedUsers.userId inSubQuery validBannedUsersList(now.toEpochMilli()))
}
.toList()

for (user in dailiesRecentlyRetrievedHours) {
if (user[Dailies.receivedById] in alreadyChecked)
continue
Expand Down

0 comments on commit 025a230

Please sign in to comment.