Browse Source

minor tweaks

master
Jeffrey Paul 2 years ago
parent
commit
8ff07a4a0b
No known key found for this signature in database
3 changed files with 9 additions and 5 deletions
  1. +5
    -2
      app.go
  2. +3
    -2
      main.go
  3. +1
    -1
      steemapi.go

+ 5
- 2
app.go View File

@@ -41,8 +41,8 @@ func (self *App) main() {

func (self *App) mainloop() {
log.Infof("using %d fetching threads", self.config.desiredFetcherThreads)
// we are going to do batches of 5,000 blocks
batchSize := uint(1000)
//batchSize := uint(1000)
batchSize := uint(10)
var start BlockNumber
var end BlockNumber
for {
@@ -52,10 +52,13 @@ func (self *App) mainloop() {
time.Sleep(1 * time.Second)
continue
}
log.Infof("current network block height = %d", self.db.CurrentNetworkBlockHeight())
log.Infof("current local block height = %d", self.db.CurrentLocalBlockHeight())
// we are not synced

// how far behind are we?
countMustFetch := uint(self.db.CurrentNetworkBlockHeight() - self.db.CurrentLocalBlockHeight())
log.Infof("we are %d blocks behind", countMustFetch)
start = self.db.CurrentLocalBlockHeight() + 1
log.Infof("beginning fetch with start block %d", start)
if countMustFetch <= batchSize {

+ 3
- 2
main.go View File

@@ -12,10 +12,11 @@ const redisUrl = "localhost:6379"

func main() {
app := NewApp(&appconfig{
logLevel: log.InfoLevel,
logLevel: log.DebugLevel,
// logLevel: log.InfoLevel,
apiUrl: steemAPIURL,
redisUrl: redisUrl,
desiredFetcherThreads: 20,
desiredFetcherThreads: 40,
})
app.main()
}

+ 1
- 1
steemapi.go View File

@@ -34,7 +34,7 @@ func NewSteemAPI(url string, options ...func(s SteemAPIShape)) *SteemAPI {

func (self *SteemAPI) GetDynamicGlobalProperties() (GetDynamicGlobalPropertiesResponse, error) {
var resp DynamicGlobalProperties
raw, err := self.rpc.Call("get_dynamic_global_properties", EmptyParamsRaw)
raw, err := self.rpc.Call("condenser_api.get_dynamic_global_properties", EmptyParamsRaw)
if err != nil {
return nil, err
}

Loading…
Cancel
Save