mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-02 10:52:49 +02:00
storage/inmemory: fix Patch() error handling (#4838)
The Patch() method was intended to skip any records that do not currently exist. However, currently inmemory.Backend.Patch() will return ErrNotFound if the last record in the records slice is not found (it will ignore any other previous records that are not found). Update the error handling logic here to be consistent with the postgres backend, and add a unit test to exercise this case.
This commit is contained in:
parent
c01d0e045d
commit
a771b82a72
2 changed files with 13 additions and 2 deletions
|
@ -269,12 +269,12 @@ func (backend *Backend) Patch(
|
|||
// Skip any record that does not currently exist.
|
||||
continue
|
||||
} else if err != nil {
|
||||
return
|
||||
return serverVersion, patchedRecords, err
|
||||
}
|
||||
patchedRecords = append(patchedRecords, record)
|
||||
}
|
||||
|
||||
return
|
||||
return serverVersion, patchedRecords, nil
|
||||
}
|
||||
|
||||
// patch updates the specified fields of an existing record, assuming the RWMutex is held.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue