perf: Attribution route perf improvements (#6489)

* Attribution route perf improvements

* fix clippy

* clear exemptions when user attempts to scan their file

* Increase Redis TTL/refresh time
This commit is contained in:
aecsocket
2026-06-24 17:48:35 +02:00
committed by GitHub
parent 29110890e1
commit c392c85917
19 changed files with 333 additions and 127 deletions
@@ -0,0 +1,14 @@
{
"db_name": "PostgreSQL",
"query": "\n\t\tinsert into file_scans (file_id)\n\t\tselect f.id\n\t\tfrom files f\n\t\twhere f.version_id = any($1)\n\t\ton conflict (file_id) do nothing\n\t\t",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array"
]
},
"nullable": []
},
"hash": "1206e354ee5be83bca26b802b1e7a7ebdf9ee4ae9a142ee93e89ddc1536e7284"
}
@@ -0,0 +1,23 @@
{
"db_name": "PostgreSQL",
"query": "\n\t\tselect distinct f.version_id as \"version_id: DBVersionId\"\n\t\tfrom override_file_sources ofs\n\t\tinner join files f on f.id = ofs.file_id\n\t\tinner join versions v on v.id = f.version_id\n\t\twhere ofs.sha1 = $1\n\t\t\tand v.mod_id = $2\n\t\t",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "version_id: DBVersionId",
"type_info": "Int8"
}
],
"parameters": {
"Left": [
"Bytea",
"Int8"
]
},
"nullable": [
false
]
},
"hash": "365d51d5c56e9420618bd23ec2f0624cb261a1aeb1f929277fa063d730c2d99a"
}
@@ -1,14 +0,0 @@
{
"db_name": "PostgreSQL",
"query": "\n\t\tinsert into file_scans (file_id)\n\t\tselect f.id\n\t\tfrom files f\n\t\tinner join attribution_enforced_versions aev on aev.id = f.version_id\n\t\twhere f.version_id = any($1)\n\t\ton conflict (file_id) do nothing\n\t\t",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array"
]
},
"nullable": []
},
"hash": "43ce7cbf44ce123c3d71c5dee035022d2e6b537eb53fcb39608e820e77174b81"
}
@@ -0,0 +1,15 @@
{
"db_name": "PostgreSQL",
"query": "\n\t\tdelete from attributions_exemptions\n\t\twhere version_id = any($1) or project_id = any($2)\n\t\t",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Int8Array",
"Int8Array"
]
},
"nullable": []
},
"hash": "70d1e6c703a2124e96e60a3fabe90b0b2dcb0c8631fdf5da57b3bc8047acfef2"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "\n select version_id as \"version_id: DBVersionId\"\n from files\n where id = $1\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "version_id: DBVersionId",
"type_info": "Int8"
}
],
"parameters": {
"Left": [
"Int8"
]
},
"nullable": [
false
]
},
"hash": "752eb66451b57e9595b8a1671b1f98465ddb903a57d566de9e472b0b78ad2d39"
}
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "\n\t\tselect distinct f.version_id as \"version_id: DBVersionId\"\n\t\tfrom project_attribution_files paf\n\t\tinner join project_attribution_groups pag on pag.id = paf.group_id\n\t\tinner join override_file_sources ofs on ofs.sha1 = paf.sha1\n\t\tinner join files f on f.id = ofs.file_id\n\t\tinner join versions v on v.id = f.version_id\n\t\twhere paf.group_id = any($1)\n\t\t\tand pag.project_id = v.mod_id\n\t\t",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "version_id: DBVersionId",
"type_info": "Int8"
}
],
"parameters": {
"Left": [
"Int8Array"
]
},
"nullable": [
false
]
},
"hash": "a68a8b6e1fb06fac7021657120e8446067fcc40dc1cf7f75670fdf2486b19f41"
}