From eb639e4fa84bf205205acc976af63f1ab6a0539f Mon Sep 17 00:00:00 2001 From: "Ding, Yi1" Date: Mon, 22 Jan 2024 22:07:18 +0800 Subject: [PATCH] check running --- neural_speed/application/main_pybind.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/neural_speed/application/main_pybind.cpp b/neural_speed/application/main_pybind.cpp index cb59249c6..ba7ac20fb 100644 --- a/neural_speed/application/main_pybind.cpp +++ b/neural_speed/application/main_pybind.cpp @@ -209,6 +209,7 @@ class ModelServer { }; int issueQuery(std::vector& qs) { + if (!running) throw std::runtime_error("Server stopped!"); std::lock_guard lock(queue_mtx); std::copy(qs.cbegin(), qs.cend(), std::back_inserter(waiting)); return waiting.size();