mirror of
https://github.com/multipleof4/ntfy.git
synced 2026-10-08 21:05:21 +00:00
Route authorization query to read-only database replica to reduce primary database load
This commit is contained in:
+5
-1
@@ -1787,4 +1787,8 @@ and the [ntfy Android app](https://github.com/binwiederhier/ntfy-android/release
|
|||||||
|
|
||||||
## Not released yet
|
## Not released yet
|
||||||
|
|
||||||
Nothing to see here.
|
### ntfy server v2.20.x (UNRELEASED)
|
||||||
|
|
||||||
|
**Bug fixes + maintenance:**
|
||||||
|
|
||||||
|
* Route authorization query to read-only database replica to reduce primary database load
|
||||||
|
|||||||
+1
-1
@@ -642,7 +642,7 @@ func (a *Manager) AllowReservation(username string, topic string) error {
|
|||||||
// - Furthermore, the query prioritizes more specific permissions (longer!) over more generic ones, e.g. "test*" > "*"
|
// - Furthermore, the query prioritizes more specific permissions (longer!) over more generic ones, e.g. "test*" > "*"
|
||||||
// - It also prioritizes write permissions over read permissions
|
// - It also prioritizes write permissions over read permissions
|
||||||
func (a *Manager) authorizeTopicAccess(usernameOrEveryone, topic string) (read, write, found bool, err error) {
|
func (a *Manager) authorizeTopicAccess(usernameOrEveryone, topic string) (read, write, found bool, err error) {
|
||||||
rows, err := a.db.Query(a.queries.selectTopicPerms, Everyone, usernameOrEveryone, topic)
|
rows, err := a.db.ReadOnly().Query(a.queries.selectTopicPerms, Everyone, usernameOrEveryone, topic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, false, false, err
|
return false, false, false, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user