extended logging + timeout setting

This commit is contained in:
Stephan D
2025-12-24 01:59:37 +01:00
parent 79b7899658
commit cefb9706f9
8 changed files with 31 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ type Deps struct {
Networks *rpcclient.Registry
Storage storage.Repository
Clock clockpkg.Clock
RPCTimeout time.Duration
EnsureRepository func(context.Context) error
LaunchExecution func(transferRef, sourceWalletRef string, network shared.Network)
}

View File

@@ -122,7 +122,11 @@ func estimateNetworkFee(ctx context.Context, logger mlogger.Logger, network shar
}
defer client.Close()
timeoutCtx, cancel := context.WithTimeout(ctx, 15*time.Second)
timeout := c.deps.RPCTimeout
if timeout <= 0 {
timeout = 15 * time.Second
}
timeoutCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
tokenABI, err := abi.JSON(strings.NewReader(erc20TransferABI))

View File

@@ -18,6 +18,7 @@ type Deps struct {
Storage storage.Repository
Clock clockpkg.Clock
BalanceCacheTTL time.Duration
RPCTimeout time.Duration
EnsureRepository func(context.Context) error
}

View File

@@ -64,7 +64,11 @@ func onChainWalletBalance(ctx context.Context, deps Deps, wallet *model.ManagedW
return nil, err
}
timeoutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
timeout := deps.RPCTimeout
if timeout <= 0 {
timeout = 10 * time.Second
}
timeoutCtx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
tokenABI, err := abi.JSON(strings.NewReader(erc20ABIJSON))