Skip to content

Commit

Permalink
add more logging & pass extra params to env
Browse files Browse the repository at this point in the history
  • Loading branch information
dkuryakin committed Apr 8, 2022
1 parent dbcacb4 commit dc391bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions chain_events/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func NewListener(
opt(listener)
}

log.Debug(listener)

return listener
}

Expand Down Expand Up @@ -167,6 +169,7 @@ func (l *ListenerImpl) Start() Listener {
// Unable to connect to chain, pause system.
if l.systemService != nil {
entry.Warn("Unable to connect to chain, pausing system")
entry.Warn(err)
if err := l.systemService.Pause(); err != nil {
entry.
WithFields(log.Fields{"error": err}).
Expand Down
2 changes: 2 additions & 0 deletions configs/configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ type Config struct {

// Sleep duration in case of service isHalted
PauseDuration time.Duration `env:"PAUSE_DURATION" envDefault:"60s"`

GrpcMaxCallRecvMsgSize int `env:"GRPC_MAX_CALL_RECV_MSG_SIZE" envDefault:"16777216"`
}

// Parse parses environment variables and flags to a valid Config.
Expand Down
3 changes: 3 additions & 0 deletions jobs/workerpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func NewWorkerPool(db Store, capacity uint, workerCount uint, opts ...WorkerPool
// Register asynchronous job executor.
pool.RegisterExecutor(SendJobStatusJobType, pool.executeSendJobStatus)

pool.logger.Debug(pool)

return pool
}

Expand Down Expand Up @@ -320,6 +322,7 @@ func (wp *WorkerPoolImpl) startWorkers() {
if wallet_errors.IsChainConnectionError(err) {
if wp.systemService != nil {
entry.Warn("Unable to connect to chain, pausing system")
entry.Warn(err)
// Unable to connect to chain, pause system.
if err := wp.systemService.Pause(); err != nil {
entry.
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ func runServer(cfg *configs.Config) {

// Flow client
// TODO: WithInsecure()?
fc, err := client.New(cfg.AccessAPIHost, grpc.WithTransportCredentials(insecure.NewCredentials()))
fc, err := client.New(
cfg.AccessAPIHost,
grpc.WithTransportCredentials(insecure.NewCredentials()),
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(cfg.GrpcMaxCallRecvMsgSize)),
)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit dc391bd

Please sign in to comment.