Skip to content

Commit

Permalink
Collator: change deferring behavior when out queue size is big
Browse files Browse the repository at this point in the history
  • Loading branch information
SpyCheese committed Sep 5, 2024
1 parent a4feef6 commit 7070fb0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions validator/impl/collator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3063,10 +3063,13 @@ int Collator::process_one_new_message(block::NewOutMsg msg, bool enqueue_only, R
bool is_special_account = is_masterchain() && config_->is_special_smartcontract(src_addr);
bool defer = false;
if (!from_dispatch_queue) {
auto defer_messages_after = collator_opts_->defer_messages_after;
if (out_msg_queue_size_ > defer_out_queue_size_limit_) {
defer_messages_after = std::min<td::uint32>(defer_messages_after, 2);
}
if (deferring_messages_enabled_ && collator_opts_->deferring_enabled && !is_special && !is_special_account &&
!collator_opts_->whitelist.count({src_wc, src_addr}) && msg.msg_idx != 0) {
if (++sender_generated_messages_count_[src_addr] >= collator_opts_->defer_messages_after ||
out_msg_queue_size_ > defer_out_queue_size_limit_) {
if (++sender_generated_messages_count_[src_addr] >= defer_messages_after) {
defer = true;
}
}
Expand Down Expand Up @@ -3684,9 +3687,9 @@ bool Collator::process_dispatch_queue() {
} else if (out_msg_queue_size_ <= 256) {
max_per_initiator[2] = 10;
} else if (out_msg_queue_size_ <= 512) {
max_per_initiator[2] = 2;
max_per_initiator[2] = 3;
} else if (out_msg_queue_size_ <= 1500) {
max_per_initiator[2] = 1;
max_per_initiator[2] = 2;
}
for (int iter = 0; iter < 3; ++iter) {
if (max_per_initiator[iter] == 0 || max_total_count[iter] == 0) {
Expand Down

0 comments on commit 7070fb0

Please sign in to comment.