Move constraint filtering down into JobStorage to improve perf.

This commit is contained in:
Greyson Parrelli
2024-07-18 13:59:24 -04:00
committed by Nicholas Tinsley
parent 36dface175
commit 06d475fb6e
11 changed files with 187 additions and 228 deletions

View File

@@ -197,28 +197,6 @@ class JobDatabase(
.readToList { it.toJobSpec() }
}
@Synchronized
fun getJobSpecsByKeys(keys: Collection<String>): List<JobSpec> {
if (keys.isEmpty()) {
return emptyList()
}
val output: MutableList<JobSpec> = ArrayList(keys.size)
for (query in SqlUtil.buildCollectionQuery(Jobs.JOB_SPEC_ID, keys)) {
readableDatabase
.select()
.from(Jobs.TABLE_NAME)
.where(query.where, query.whereArgs)
.run()
.forEach {
output += it.toJobSpec()
}
}
return output
}
@Synchronized
fun getMostEligibleJobInQueue(queue: String): JobSpec? {
return readableDatabase