Txs batching change merge #1
Conversation
Transaction processing is now based bytes size of the transactions
| wait_start = now; | ||
|
|
||
| if(!wallet_queue.empty() && | ||
| (curr_batch_size < udl->config.wallet_persistence_batch_min_size) || |
There was a problem hiding this comment.
This seems like a logic error because if curr_batch_size and batch_min_size are both 0, the expression will never be true. Since the body of the if statement adds another wallet to the batch, it seems like the head of the if statement should either check if curr_batch_size is greater than the minimum, or less than the maximum (e.g. batch_max_size).
| (curr_batch_size < udl->config.wallet_persistence_batch_min_size) || | ||
| ((now-wait_start) >= batch_time)) { | ||
| std::size_t wallet_size = mutils::bytes_size(std::get<1>(wallet_queue.front())); | ||
| if (curr_batch_size + wallet_size < udl->config.wallet_persistence_batch_min_size){ |
There was a problem hiding this comment.
This is a logic error: This if statement will only add wallet_queue.front() to the current batch if the new batch size (curr_batch_size + wallet_size) would be less than the minimum batch size, which is (almost) never true. It should either test if the new batch size would be greater than the minimum, or test if the new batch size would be less than the maximum. I'm not sure which is intended, but I'm guessing it's "greater than the minimum"
| } | ||
|
|
||
| // Reset for next batch | ||
| curr_batch_size = 0; |
There was a problem hiding this comment.
Why is this reset on every loop iteration? Shouldn't it only be reset if the batch was actually sent via put_objects (i.e. inside the above if statement?)
This branch was made to move all the batching to use byte size of the transaction/wallet/requests instead of the size of the queue of the transactions/wallet/requests