mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-02 10:52:49 +02:00
authorize: refactor store locking (#2151)
* authorize: refactor store locking * fix nil reference panic
This commit is contained in:
parent
9215833a0b
commit
c85c8b0778
5 changed files with 82 additions and 55 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"sync"
|
||||
|
||||
"github.com/pomerium/pomerium/authorize/evaluator"
|
||||
"github.com/pomerium/pomerium/config"
|
||||
|
@ -24,6 +25,11 @@ type Authorize struct {
|
|||
templates *template.Template
|
||||
|
||||
dataBrokerInitialSync chan struct{}
|
||||
|
||||
// The stateLock prevents updating the evaluator store simultaneously with an evaluation.
|
||||
// This should provide a consistent view of the data at a given server/record version and
|
||||
// avoid partial updates.
|
||||
stateLock sync.RWMutex
|
||||
}
|
||||
|
||||
// New validates and creates a new Authorize service from a set of config options.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue