Skip to content

Commit

Permalink
fix: null extra result (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: zjtv <[email protected]>
  • Loading branch information
zjtv authored Aug 14, 2024
1 parent b0cf5af commit fa46a4f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package control
import (
"errors"
"strconv"

sql "github.com/FloatTech/sqlite"
)

// InitResponse ...
Expand Down Expand Up @@ -50,8 +52,9 @@ func (manager *Manager[CTX]) CanResponse(gid int64) bool {
if ok {
return ext != "-"
}
manager.RLock()

var rsp ResponseGroup
manager.RLock()
err := manager.D.Find("__resp", &rsp, "where gid = 0") // all status
manager.RUnlock()
if err == nil && rsp.Extra != "-" {
Expand All @@ -63,7 +66,7 @@ func (manager *Manager[CTX]) CanResponse(gid int64) bool {
manager.RLock()
err = manager.D.Find("__resp", &rsp, "where gid = "+strconv.FormatInt(gid, 10))
manager.RUnlock()
if err != nil {
if err != nil && !errors.Is(err, sql.ErrNullResult) {
manager.Lock()
respCache[gid] = "-"
manager.Unlock()
Expand Down

0 comments on commit fa46a4f

Please sign in to comment.