mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 05:52:20 +08:00
feat: add time to taskQueue
License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com> Conflicts: exchange/bitswap/decision/taskqueue.go
This commit is contained in:
@ -3,6 +3,7 @@ package decision
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
wantlist "github.com/jbenet/go-ipfs/exchange/bitswap/wantlist"
|
||||
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
||||
@ -28,7 +29,9 @@ func newTaskQueue() *taskQueue {
|
||||
type task struct {
|
||||
Entry wantlist.Entry
|
||||
Target peer.ID
|
||||
Trash bool
|
||||
Trash bool // TODO make private
|
||||
|
||||
created time.Time
|
||||
}
|
||||
|
||||
func (t *task) String() string {
|
||||
@ -46,8 +49,9 @@ func (tl *taskQueue) Push(entry wantlist.Entry, to peer.ID) {
|
||||
return
|
||||
}
|
||||
task := &task{
|
||||
Entry: entry,
|
||||
Target: to,
|
||||
Entry: entry,
|
||||
Target: to,
|
||||
created: time.Now(),
|
||||
}
|
||||
tl.tasks = append(tl.tasks, task)
|
||||
tl.taskmap[taskKey(to, entry.Key)] = task
|
||||
|
Reference in New Issue
Block a user