Skip to content

Commit

Permalink
Renamed session model indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Mar 2, 2023
1 parent fd2a28e commit 7a064d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion context/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (c *Context) RemovePeerIfExists(key string) error {
return err
}
if !ok {
c.Log().Info("Peer does not exist", "key", key)
c.Log().Debug("Peer does not exist", "key", key)
return nil
}

Expand Down
9 changes: 5 additions & 4 deletions node/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ func (n *Node) jobSetSessions() error {
return err
}

for i := 0; i < len(peers); i++ {
count := len(peers)
n.Log().Debug("Validating the peers", "count", count)

for i := 0; i < count; i++ {
var item types.Session
n.Database().Model(
&types.Session{},
Expand Down Expand Up @@ -90,9 +93,7 @@ func (n *Node) jobUpdateSessions() error {
).Find(&items)

count := len(items)
if count > 0 {
n.Log().Info("Validating the sessions", "count", count)
}
n.Log().Info("Validating the sessions", "count", count)

for i := count - 1; i >= 0; i-- {
session, err := n.Client().QuerySession(items[i].ID)
Expand Down
4 changes: 2 additions & 2 deletions types/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
type Session struct {
gorm.Model
ID uint64 `gorm:"primaryKey;uniqueIndex:idx_sessions_id"`
Subscription uint64 `gorm:"index:idx_sessions_subscription_for_address"`
Subscription uint64 `gorm:"index:idx_sessions_subscription_address"`
Key string `gorm:"uniqueIndex:idx_sessions_key"`
Address string `gorm:"index:idx_sessions_address;index:idx_sessions_subscription_for_address"`
Address string `gorm:"index:idx_sessions_address;index:idx_sessions_subscription_address"`
Available int64
Download int64
Upload int64
Expand Down

0 comments on commit 7a064d4

Please sign in to comment.