parent
537be95850
commit
126933fb5e
|
@ -39,6 +39,7 @@ func init() {
|
||||||
func watchMetadata(ctx context.Context) <-chan *libnp.Info {
|
func watchMetadata(ctx context.Context) <-chan *libnp.Info {
|
||||||
ticker := time.NewTicker(time.Second)
|
ticker := time.NewTicker(time.Second)
|
||||||
c := make(chan *libnp.Info)
|
c := make(chan *libnp.Info)
|
||||||
|
var lastMetadataID [64]byte
|
||||||
go func(ticker *time.Ticker) {
|
go func(ticker *time.Ticker) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
@ -50,6 +51,14 @@ func watchMetadata(ctx context.Context) <-chan *libnp.Info {
|
||||||
os.Stderr.WriteString("WARNING: " + err.Error() + "\n")
|
os.Stderr.WriteString("WARNING: " + err.Error() + "\n")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
var newMetadataID [64]byte
|
||||||
|
if info != nil {
|
||||||
|
newMetadataID = generateIDFromMetadata(*info)
|
||||||
|
}
|
||||||
|
if newMetadataID == lastMetadataID {
|
||||||
|
// metadata did not change
|
||||||
|
continue
|
||||||
|
}
|
||||||
c <- info
|
c <- info
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue