authz: Non-blocking Bitbucket Server permissions updates
Created by: tsenart
This commit changes the Bitbucket Server permissions store to perform non-blocking permissions updates. When there are existing expired permissions, those are used immediatelly, and a background update is started. Otherwise, an error is returned to the user indicating that their permissions are stale.
This commit also changes the locking mechanism used to control concurrency of background updates so that it doesn't block. This prevents exhaustion of the Postgres connection pool.
A follow-up PR will introduce the concept of hard and soft TTLs as described in #4812 (closed).
Test plan: go test