mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-10 09: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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
wantlist "github.com/jbenet/go-ipfs/exchange/bitswap/wantlist"
|
wantlist "github.com/jbenet/go-ipfs/exchange/bitswap/wantlist"
|
||||||
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
peer "github.com/jbenet/go-ipfs/p2p/peer"
|
||||||
@ -28,7 +29,9 @@ func newTaskQueue() *taskQueue {
|
|||||||
type task struct {
|
type task struct {
|
||||||
Entry wantlist.Entry
|
Entry wantlist.Entry
|
||||||
Target peer.ID
|
Target peer.ID
|
||||||
Trash bool
|
Trash bool // TODO make private
|
||||||
|
|
||||||
|
created time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *task) String() string {
|
func (t *task) String() string {
|
||||||
@ -46,8 +49,9 @@ func (tl *taskQueue) Push(entry wantlist.Entry, to peer.ID) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
task := &task{
|
task := &task{
|
||||||
Entry: entry,
|
Entry: entry,
|
||||||
Target: to,
|
Target: to,
|
||||||
|
created: time.Now(),
|
||||||
}
|
}
|
||||||
tl.tasks = append(tl.tasks, task)
|
tl.tasks = append(tl.tasks, task)
|
||||||
tl.taskmap[taskKey(to, entry.Key)] = task
|
tl.taskmap[taskKey(to, entry.Key)] = task
|
||||||
|
Reference in New Issue
Block a user