forked from cerc-io/ipld-eth-server
Merge pull request #7 from vulcanize/VDB-347-Squelch-lightSync
VDB-347 Squelch lightSync in stdout
This commit is contained in:
commit
29f2537130
@ -17,7 +17,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -87,7 +86,7 @@ func lightSync() {
|
||||
if err != nil {
|
||||
log.Error("ValidateHeaders failed in lightSync: ", err)
|
||||
}
|
||||
window.Log(os.Stdout)
|
||||
log.Info(window.GetString())
|
||||
case n := <-missingBlocksPopulated:
|
||||
if n == 0 {
|
||||
time.Sleep(3 * time.Second)
|
||||
|
@ -17,7 +17,6 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@ -87,7 +86,7 @@ func sync() {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
window := validator.ValidateBlocks()
|
||||
window.Log(os.Stdout)
|
||||
log.Info(window.GetString())
|
||||
case <-missingBlocksPopulated:
|
||||
go backFillAllBlocks(blockChain, blockRepository, missingBlocksPopulated, startingBlockNumber)
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
package history
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/vulcanize/vulcanizedb/pkg/core"
|
||||
"io"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
@ -52,6 +52,7 @@ func MakeRange(min, max int64) []int64 {
|
||||
return a
|
||||
}
|
||||
|
||||
func (window ValidationWindow) Log(out io.Writer) {
|
||||
ParsedWindowTemplate.Execute(out, window)
|
||||
func (window ValidationWindow) GetString() string {
|
||||
return fmt.Sprintf("Validating Blocks |%v|-- Validation Window --|%v}|",
|
||||
window.LowerBound, window.UpperBound)
|
||||
}
|
||||
|
@ -17,8 +17,6 @@
|
||||
package history_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
@ -50,15 +48,4 @@ var _ = Describe("Validation window", func() {
|
||||
|
||||
Expect(numberOfBlocksCreated).To(Equal(expected))
|
||||
})
|
||||
|
||||
It("logs window message", func() {
|
||||
expectedMessage := &bytes.Buffer{}
|
||||
window := history.ValidationWindow{LowerBound: 5, UpperBound: 7}
|
||||
history.ParsedWindowTemplate.Execute(expectedMessage, window)
|
||||
actualMessage := &bytes.Buffer{}
|
||||
|
||||
window.Log(actualMessage)
|
||||
|
||||
Expect(actualMessage).To(Equal(expectedMessage))
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user