added elapsed time to collect
This commit is contained in:
parent
5e5bef7c47
commit
329d4db397
|
@ -9,6 +9,7 @@ import (
|
|||
"log"
|
||||
"strconv"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -76,11 +77,15 @@ func (c *Collector) collect(id string) {
|
|||
in.Id = id
|
||||
in.Name = grpc.Crawlers(grpc.Crawlers_value[conf.Crawler.Name])
|
||||
|
||||
startAt := time.Now().Unix()
|
||||
out, err := dc.Get(context.Background(), in)
|
||||
finishedAt := time.Now().Unix()
|
||||
if err != nil {
|
||||
log.Printf("Cannot collect [ID: %s] [Crawler : %s] - [Err : %s]\n", conf.Id, conf.Crawler.Name, err.Error())
|
||||
return
|
||||
}
|
||||
out.StartDate = startAt
|
||||
out.EndDate = finishedAt
|
||||
log.Printf("COLLECTED. [ID: %s] [Crawler : %s] [Result : %s]\n", conf.Id, conf.Crawler.Name, out.GetData())
|
||||
c.dataCh <- out
|
||||
}()
|
||||
|
|
Loading…
Reference in New Issue
Block a user