Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parallel from withdrawal warmup #7153

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,30 +72,33 @@ void WarmupWithdrawals(ParallelOptions parallelOptions, IReleaseSpec spec, Block
{
if (spec.WithdrawalsEnabled && block.Withdrawals is not null)
{
Parallel.For(0, block.Withdrawals.Length, parallelOptions,
i =>
ReadOnlyTxProcessingEnv env = _envPool.Get();
try
{
foreach (Withdrawal withdrawal in block.Withdrawals)
{
ReadOnlyTxProcessingEnv env = _envPool.Get();
try
{
env.StateProvider.WarmUp(block.Withdrawals[i].Address);
}
catch (Exception ex)
{
if (_logger.IsDebug) _logger.Error($"Error pre-warming withdrawal {i}", ex);
}
finally
{
env.Reset();
_envPool.Return(env);
}
});
if (parallelOptions.CancellationToken.IsCancellationRequested) return;

env.StateProvider.WarmUp(withdrawal.Address);
}
}
catch (Exception ex)
{
if (_logger.IsDebug) _logger.Error($"Error pre-warming withdrawals", ex);
}
finally
{
env.Reset();
_envPool.Return(env);
}
}
}

void WarmupTransactions(ParallelOptions parallelOptions, IReleaseSpec spec, Block block, Hash256 stateRoot)
{
Parallel.For(0, block.Transactions.Length, parallelOptions, i =>
if (parallelOptions.CancellationToken.IsCancellationRequested) return;

Parallel.For(0, block.Transactions.Length, parallelOptions, (i) =>
{
// If the transaction has already been processed or being processed, exit early
if (block.TransactionProcessed >= i) return;
Expand Down