Skip to content
Closed
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
14 changes: 4 additions & 10 deletions src/workers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,6 @@ ProducerConnect::ProducerConnect(Nan::Callback *callback, Producer* producer):
ProducerConnect::~ProducerConnect() {}

void ProducerConnect::Execute() {
// Activate the dispatchers before the connection, as some callbacks may run
// on the background thread.
// We will deactivate them if the connection fails.
producer->ActivateDispatchers();

Baton b = producer->Connect();

if (b.err() != RdKafka::ERR_NO_ERROR) {
Expand All @@ -222,6 +217,9 @@ void ProducerConnect::HandleOKCallback() {

v8::Local<v8::Value> argv[argc] = { Nan::Null(), obj};

// Activate the dispatchers
producer->ActivateDispatchers();

callback->Call(argc, argv);
}

Expand Down Expand Up @@ -558,11 +556,6 @@ KafkaConsumerConnect::KafkaConsumerConnect(Nan::Callback *callback,
KafkaConsumerConnect::~KafkaConsumerConnect() {}

void KafkaConsumerConnect::Execute() {
// Activate the dispatchers before the connection, as some callbacks may run
// on the background thread.
// We will deactivate them if the connection fails.
consumer->ActivateDispatchers();

Baton b = consumer->Connect();
// consumer->Wait();

Expand All @@ -582,6 +575,7 @@ void KafkaConsumerConnect::HandleOKCallback() {
Nan::New(consumer->Name()).ToLocalChecked());

v8::Local<v8::Value> argv[argc] = { Nan::Null(), obj };
consumer->ActivateDispatchers();

callback->Call(argc, argv);
}
Expand Down