Skip to content

Commit

Permalink
GetOrchestrator slowness when PM Sender data is not cached (livepee…
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk-dev authored and eliteprox committed Feb 21, 2024
1 parent 0176c21 commit a68617e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ var (
txCostMultiplier = 100

// The interval at which to clean up cached max float values for PM senders and balances per stream
cleanupInterval = 1 * time.Minute
cleanupInterval = 10 * time.Minute
// The time to live for cached max float values for PM senders (else they will be cleaned up) in seconds
smTTL = 60 // 1 minute
smTTL = 172800 // 2 days
)

const (
Expand Down
3 changes: 2 additions & 1 deletion pm/sendermonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/golang/glog"
Expand Down Expand Up @@ -272,7 +273,6 @@ func (sm *LocalSenderMonitor) cache(addr ethcommon.Address) {
queue.Start()
done := make(chan struct{})
go sm.startTicketQueueConsumerLoop(queue, done)

sm.senders[addr] = &remoteSender{
pendingAmount: big.NewInt(0),
queue: queue,
Expand Down Expand Up @@ -347,6 +347,7 @@ func (sm *LocalSenderMonitor) cleanup() {
v.subScope.Close() // close the maxfloat subscriptions
delete(sm.senders, k)
sm.smgr.Clear(k)
glog.V(6).Infof("sender cleared from cache addr: %v last access: %v ttl: %vs", hexutil.Encode(k.Bytes()), v.lastAccess, sm.cfg.TTL)
}
}
}
Expand Down

0 comments on commit a68617e

Please sign in to comment.