Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ljcui committed Dec 9, 2024
1 parent 2ec4c3f commit e92a201
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/bolt/blocking_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class BlockingQueue {
}
condition_.notify_one();
}
void Notify() {
condition_.notify_one();
}
T Pop() {
std::unique_lock<std::mutex> lock(mutex_);
condition_.wait(lock, [this] {return !queue_.empty();});
Expand Down
5 changes: 5 additions & 0 deletions src/bolt/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "bolt/connection.h"
#include "bolt/messages.h"
#include "bolt/to_string.h"
#include "server/bolt_session.h"

namespace bolt {
using namespace boost::asio;
Expand Down Expand Up @@ -100,6 +101,10 @@ void BoltConnection::Start() {

void BoltConnection::Close() {
Connection::Close();
if (context_) {
auto session = (BoltSession*)GetContext();
session->msgs.Notify();
}
}

void BoltConnection::DoSend() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/thread_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "fma-common/assert.h"

namespace lgraph {
static const int LGRAPH_MAX_THREADS = 480;
static const int LGRAPH_MAX_THREADS = 65000;

class ThreadIdAssigner {
static const int N = LGRAPH_MAX_THREADS;
Expand Down
2 changes: 1 addition & 1 deletion src/server/bolt_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void BoltFSM(std::shared_ptr<BoltConnection> conn) {
session->state = SessionState::FAILED;
};
while (!conn->has_closed()) {
auto msg = session->msgs.Pop(std::chrono::milliseconds(100));
auto msg = session->msgs.Pop(std::chrono::milliseconds(10));
if (!msg) { // msgs pop timeout
continue;
}
Expand Down

0 comments on commit e92a201

Please sign in to comment.