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

Mon 14375 queue size limited #342

Merged
merged 14 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(broker/engine): unused code removed
  • Loading branch information
bouda1 committed Aug 3, 2022
commit bd40971ab09ff0b9c84810fac85e8415dfbe082e
6 changes: 3 additions & 3 deletions broker/bam/test/ba/kpi_ba.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class KpiBA : public ::testing::Test {
// Initialization.
config::applier::init(0, "test_broker", 0);

_aply_state.reset(new bam::configuration::applier::state);
_state.reset(new bam::configuration::state);
_visitor.reset(new test_visitor("test-visitor"));
_aply_state = std::make_unique<bam::configuration::applier::state>();
_state = std::make_unique<bam::configuration::state>();
_visitor = std::make_unique<test_visitor>("test-visitor");
}

void TearDown() override {
Expand Down
6 changes: 2 additions & 4 deletions broker/core/inc/com/centreon/broker/multiplexing/engine.hh
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,18 @@ class engine {
uint32_t _unprocessed_events;

std::atomic_bool _sending_to_subscribers;
const size_t _event_queues_total_size;

engine(size_t event_queues_total_size);
engine();
std::string _cache_file_path() const;
void _send_to_subscribers();

void (engine::*_write_func)(std::shared_ptr<io::data> const&);

public:
static void load(size_t event_queues_total_size);
static void load();
static void unload();
static engine& instance();

engine() = delete;
engine(const engine&) = delete;
engine& operator=(const engine&) = delete;
~engine() noexcept;
Expand Down
2 changes: 1 addition & 1 deletion broker/core/src/config/applier/init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void config::applier::init(size_t n_thread,
mysql_manager::load();
config::applier::state::load();
file::disk_accessor::load(event_queues_total_size);
multiplexing::engine::load(event_queues_total_size);
multiplexing::engine::load();
io::protocols::load();
io::events::load();
config::applier::endpoint::load();
Expand Down
13 changes: 4 additions & 9 deletions broker/core/src/multiplexing/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,12 @@ engine& engine::instance() {
/**
* @brief Load engine instance. The argument is the total size allowed for
* queue files.
*
* @param event_queues_total_size A size in bytes.
*/
void engine::load(size_t event_queues_total_size) {
void engine::load() {
log_v2::core()->trace("multiplexing: loading engine");
std::lock_guard<std::mutex> lk(_load_m);
if (!_instance)
_instance = new engine(event_queues_total_size);
_instance = new engine();
}

/**
Expand Down Expand Up @@ -264,17 +262,14 @@ void engine::unsubscribe(muxer* subscriber) {
/**
* @brief Constructor of the multiplexing engine. The argument is the total
* size allowed for the queue files. If 0 is specified, no limit is given.
*
* @param event_queues_total_size A size in bytes.
*/
engine::engine(size_t event_queues_total_size)
engine::engine()
: _state{not_started},
_strand(pool::instance().io_context()),
_muxers{},
_stats{stats::center::instance().register_engine()},
_unprocessed_events{0u},
_sending_to_subscribers{false},
_event_queues_total_size{event_queues_total_size} {
_sending_to_subscribers{false} {
stats::center::instance().update(&EngineStats::set_mode, _stats,
EngineStats::NOT_STARTED);
}
Expand Down
2 changes: 1 addition & 1 deletion broker/core/test/processing/feeder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class TestFeeder : public ::testing::Test {
stats::center::load();
config::applier::state::load();
file::disk_accessor::load(10000);
multiplexing::engine::load(0);
multiplexing::engine::load();
io::protocols::load();
io::events::load();

Expand Down
2 changes: 1 addition & 1 deletion broker/stats/test/stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class StatsTest : public ::testing::Test {
mysql_manager::load();
config::applier::state::load();
file::disk_accessor::load(10000);
multiplexing::engine::load(0);
multiplexing::engine::load();
io::protocols::load();
io::events::load();
config::applier::endpoint::load();
Expand Down