Skip to content

Commit

Permalink
put short delay between each publish in RepublishAll
Browse files Browse the repository at this point in the history
theory is that community block store is filling up
its ingress buffer inside libp2p
  • Loading branch information
Brandon Westcott committed Jun 26, 2019
1 parent b688e3a commit 5e4cd5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions network/ipldstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ func (ts *IPLDTreeStore) RepublishAll() error {
}
log.Infof("publishing %s", node.Cid().String())
actor.EmptyRootContext.Send(ts.publisher, node)
time.Sleep(15 * time.Millisecond)
}
return nil
}
Expand Down
14 changes: 12 additions & 2 deletions republisher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"encoding/json"
"os"
"path/filepath"
"time"

"github.com/quorumcontrol/jasons-game/network"

"github.com/pkg/errors"
logging "github.com/ipfs/go-log"
"github.com/pkg/errors"

"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
Expand All @@ -21,12 +22,16 @@ import (

const sessionStorageDir = "session-storage"

var log = logging.Logger("gamenetwork")

func doIt(ctx context.Context) error {
err := logging.SetLogLevel("gamenetwork", "info")
if err != nil {
return errors.Wrap(err, "error setting log level")
}

log.Infof("Starting republisher")

group, err := setupNotaryGroup(ctx, false)
if err != nil {
panic(errors.Wrap(err, "setting up notary group"))
Expand All @@ -52,7 +57,12 @@ func doIt(ctx context.Context) error {
panic(errors.Wrap(err, "setting up network"))
}

return net.(*network.RemoteNetwork).RepublishAll()
err = net.(*network.RemoteNetwork).RepublishAll()
if err != nil {
panic(errors.Wrap(err, "error on publish"))
}
time.Sleep(5 * time.Second)
return nil
}

func main() {
Expand Down

0 comments on commit 5e4cd5b

Please sign in to comment.