supabase / supavisor

A cloud-native, multi-tenant Postgres connection pooler.
https://supabase.github.io/supavisor/
Apache License 2.0
1.65k stars 54 forks source link

ft: do not traverse whole state for actions handling #377

Closed hauleth closed 5 days ago

hauleth commented 5 days ago

What kind of change does this PR introduce?

Performance fix

What is the current behavior?

We traverse whole state each time we want to compute whether we want to enable any timeouts. It causes measurable performance hit. As it is map and we know only that there is only limited set of keys that can affect timeouts it is better to access it directly.

What is the new behavior?

Access only required fields. It also makes that function performance less dependant on state size.