mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 09:59:13 +08:00
some comments
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
@ -71,6 +71,7 @@ func (rl *ReqLog) maybeCleanup() {
|
|||||||
|
|
||||||
func (rl *ReqLog) cleanup() {
|
func (rl *ReqLog) cleanup() {
|
||||||
var i int
|
var i int
|
||||||
|
// drop all logs at are inactive and more than an hour old
|
||||||
for ; i < len(rl.Requests); i++ {
|
for ; i < len(rl.Requests); i++ {
|
||||||
req := rl.Requests[i]
|
req := rl.Requests[i]
|
||||||
if req.Active || req.EndTime.Add(time.Hour).After(time.Now()) {
|
if req.Active || req.EndTime.Add(time.Hour).After(time.Now()) {
|
||||||
@ -89,6 +90,7 @@ func (rl *ReqLog) cleanup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Report generates a copy of all the entries in the requestlog
|
||||||
func (rl *ReqLog) Report() []*ReqLogEntry {
|
func (rl *ReqLog) Report() []*ReqLogEntry {
|
||||||
rl.lock.Lock()
|
rl.lock.Lock()
|
||||||
defer rl.lock.Unlock()
|
defer rl.lock.Unlock()
|
||||||
|
Reference in New Issue
Block a user