Skip to content

Commit

Permalink
GH-1784 Use ceil to take the most conservative approach to the user p…
Browse files Browse the repository at this point in the history
…rovided offset
  • Loading branch information
heifner committed Oct 20, 2023
1 parent a336ef2 commit 440d33a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
void set_produce_block_offset(uint32_t produce_block_offset_ms) {
EOS_ASSERT(produce_block_offset_ms < (config::producer_repetitions * config::block_interval_ms), plugin_config_exception,
"produce-block-offset-ms ${p} must be [0 - ${max})", ("p", produce_block_offset_ms)("max", config::producer_repetitions * config::block_interval_ms));
_produce_block_cpu_effort = fc::milliseconds(config::block_interval_ms - produce_block_offset_ms / config::producer_repetitions );
_produce_block_cpu_effort = fc::milliseconds(
config::block_interval_ms - static_cast<int64_t>(std::ceil(produce_block_offset_ms / static_cast<double>(config::producer_repetitions))) );
}

fc::microseconds get_produce_block_offset() const {
Expand Down

0 comments on commit 440d33a

Please sign in to comment.