mirror of
https://github.com/status-im/status-go.git
synced 2025-02-20 02:38:13 +00:00
chore_: bump mvds (#5623)
This commit is contained in:
parent
5d309e2c64
commit
bacd4f5e5c
2
go.mod
2
go.mod
@ -55,7 +55,7 @@ require (
|
||||
github.com/status-im/doubleratchet v3.0.0+incompatible
|
||||
github.com/status-im/markdown v0.0.0-20240404192634-b7e33c6ac3d4
|
||||
github.com/status-im/migrate/v4 v4.6.2-status.3
|
||||
github.com/status-im/mvds v0.0.27-0.20240624014816-2dd6758177e5
|
||||
github.com/status-im/mvds v0.0.27-0.20240729032523-f6fba962c2b1
|
||||
github.com/status-im/rendezvous v1.3.8-0.20240110194857-cc5be22bf83e
|
||||
github.com/status-im/status-go/extkeys v1.1.2
|
||||
github.com/status-im/tcp-shaker v1.1.1-status
|
||||
|
4
go.sum
4
go.sum
@ -2036,8 +2036,8 @@ github.com/status-im/markdown v0.0.0-20240404192634-b7e33c6ac3d4 h1:KBeXtOoisXji
|
||||
github.com/status-im/markdown v0.0.0-20240404192634-b7e33c6ac3d4/go.mod h1:5rjPyv3KffPNVbFjnsVy0NGj9+JeW40WvXLdxH1VKuE=
|
||||
github.com/status-im/migrate/v4 v4.6.2-status.3 h1:Khwjb59NzniloUr5i9s9AtkEyqBbQFt1lkoAu66sAu0=
|
||||
github.com/status-im/migrate/v4 v4.6.2-status.3/go.mod h1:c/kc90n47GZu/58nnz1OMLTf7uE4Da4gZP5qmU+A/v8=
|
||||
github.com/status-im/mvds v0.0.27-0.20240624014816-2dd6758177e5 h1:+yVCBKrEwMRsZupZJgzlmI52Sa/8KSzUD5cPAkDe7+Y=
|
||||
github.com/status-im/mvds v0.0.27-0.20240624014816-2dd6758177e5/go.mod h1:2fiAx0q9XYIPKYRq2B1oiO9zZESy/n4D32gWw6lMDsE=
|
||||
github.com/status-im/mvds v0.0.27-0.20240729032523-f6fba962c2b1 h1:4idVpLp9lqLpXF32iwB2/6v4RhWJswCH+OnQCNuvHd8=
|
||||
github.com/status-im/mvds v0.0.27-0.20240729032523-f6fba962c2b1/go.mod h1:2fiAx0q9XYIPKYRq2B1oiO9zZESy/n4D32gWw6lMDsE=
|
||||
github.com/status-im/notify v1.0.2-status h1:x8wev0Sh8H8KAf4bVcv+L0dVHldBESOKUlqRqRY7uL8=
|
||||
github.com/status-im/notify v1.0.2-status/go.mod h1:gF3zSOrafR9DQEWSE8TjfI9NkooDxbyT4UgRGKZA0lc=
|
||||
github.com/status-im/rendezvous v1.3.8-0.20240110194857-cc5be22bf83e h1:pCOHeAYmYttXQBCn+6u01bs5d/W3XslxmplFhru4X1Y=
|
||||
|
5
vendor/github.com/status-im/mvds/node/node.go
generated
vendored
5
vendor/github.com/status-im/mvds/node/node.go
generated
vendored
@ -40,6 +40,7 @@ const (
|
||||
)
|
||||
|
||||
const FreshEventPeriod = 10 // seconds
|
||||
const MaxSendCount = 15 // stop resend the message after 15 times (~10 days)
|
||||
|
||||
type PeerStatusChangeEvent struct {
|
||||
PeerID state.PeerID
|
||||
@ -223,6 +224,10 @@ func (n *Node) Start(duration time.Duration) {
|
||||
if err != nil {
|
||||
n.logger.Error("Error sending messages.", zap.Error(err))
|
||||
}
|
||||
err = n.syncState.Clear(MaxSendCount)
|
||||
if err != nil {
|
||||
n.logger.Error("Error clearing sync state.", zap.Error(err))
|
||||
}
|
||||
atomic.AddInt64(&n.epoch, 1)
|
||||
// When a persistent node is used, the epoch needs to be saved.
|
||||
if n.epochPersistence != nil {
|
||||
|
1
vendor/github.com/status-im/mvds/state/state.go
generated
vendored
1
vendor/github.com/status-im/mvds/state/state.go
generated
vendored
@ -27,4 +27,5 @@ type SyncState interface {
|
||||
All(epoch int64) ([]State, error)
|
||||
Map(epoch int64, process func(State) State) error
|
||||
MapWithPeerId(peerID PeerID, process func(State) State) error
|
||||
Clear(count uint64) error
|
||||
}
|
||||
|
16
vendor/github.com/status-im/mvds/state/state_memory.go
generated
vendored
16
vendor/github.com/status-im/mvds/state/state_memory.go
generated
vendored
@ -72,3 +72,19 @@ func (s *memorySyncState) MapWithPeerId(peerID PeerID, process func(State) State
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *memorySyncState) Clear(count uint64) error {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
var newState []State
|
||||
for _, state := range s.state {
|
||||
if state.SendCount <= count {
|
||||
newState = append(newState, state)
|
||||
}
|
||||
}
|
||||
|
||||
s.state = newState
|
||||
|
||||
return nil
|
||||
}
|
||||
|
8
vendor/github.com/status-im/mvds/state/state_sqlite.go
generated
vendored
8
vendor/github.com/status-im/mvds/state/state_sqlite.go
generated
vendored
@ -220,6 +220,14 @@ func (p *sqliteSyncState) MapWithPeerId(peerID PeerID, process func(State) State
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
func (p *sqliteSyncState) Clear(count uint64) error {
|
||||
_, err := p.db.Exec(
|
||||
`DELETE FROM mvds_states WHERE send_count > ?`,
|
||||
count,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
func updateInTx(tx *sql.Tx, state State) error {
|
||||
_, err := tx.Exec(`
|
||||
UPDATE mvds_states
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -934,7 +934,7 @@ github.com/status-im/migrate/v4/database/postgres
|
||||
github.com/status-im/migrate/v4/database/sqlcipher
|
||||
github.com/status-im/migrate/v4/internal/url
|
||||
github.com/status-im/migrate/v4/source/go_bindata
|
||||
# github.com/status-im/mvds v0.0.27-0.20240624014816-2dd6758177e5
|
||||
# github.com/status-im/mvds v0.0.27-0.20240729032523-f6fba962c2b1
|
||||
## explicit; go 1.19
|
||||
github.com/status-im/mvds/node
|
||||
github.com/status-im/mvds/node/migrations
|
||||
|
Loading…
x
Reference in New Issue
Block a user