@cryptotaxi247 / kubo / commits / cb1ef6e1e

feat: add time to taskQueue

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com> Conflicts: exchange/bitswap/decision/taskqueue.go

Brian Tiger Chow committed Dec 18, 2014 at 22:47 UTC cb1ef6e1e2e7ac690f8aa1ef74161b622ffa6a7b
1 file changed +7 -3
exchange/bitswap/decision/taskqueue.go
+7 -3
@@ -3,6 +3,7 @@ package decision
3 import (
4 "fmt"
5 "sync"
6 + "time"
7
8 wantlist "github.com/jbenet/go-ipfs/exchange/bitswap/wantlist"
9 peer "github.com/jbenet/go-ipfs/p2p/peer"
@@ -28,7 +29,9 @@ func newTaskQueue() *taskQueue {
29 type task struct {
30 Entry wantlist.Entry
31 Target peer.ID
31 - Trash bool
32 + Trash bool // TODO make private
33 +
34 + created time.Time
35 }
36
37 func (t *task) String() string {
@@ -46,8 +49,9 @@ func (tl *taskQueue) Push(entry wantlist.Entry, to peer.ID) {
49 return
50 }
51 task := &task{
49 - Entry: entry,
50 - Target: to,
52 + Entry: entry,
53 + Target: to,
54 + created: time.Now(),
55 }
56 tl.tasks = append(tl.tasks, task)
57 tl.taskmap[taskKey(to, entry.Key)] = task