Skip to content

authz: Use conf.Watch in SubRepoPermsClient

Administrator requested to merge rs/remove-conf-get-permissions into main

Created by: ryanslade

Instead of running conf.Get every time we call client.Enabled, which can be very frequent, we use conf.Watch to update an atomic bool indicating whether we're enabled.

Benchmark comparison of FilterActorPaths:

name                 old time/op    new time/op    delta
FilterActorPaths-10    2.51ms ± 1%    2.13ms ± 0%  -15.27%  (p=0.000 n=10+10)

name                 old paths/s    new paths/s    delta
FilterActorPaths-10     1.99M ± 1%     2.35M ± 0%  +18.03%  (p=0.000 n=10+10)

Part of https://github.com/sourcegraph/sourcegraph/issues/41347

Test plan

All tests pass

Merge request reports

Loading