Skip to content

Commit

Permalink
pub in stop.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Jul 12, 2024
1 parent 978d334 commit d091a53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lib/iq_inference_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ bool iq_inference_impl::stop() {
while (!inference_q_.empty()) {
sleep(0.001);
}
pub_json_();
running_ = false;
io_service_->stop();
threadpool_.join_all();
Expand Down Expand Up @@ -464,6 +465,14 @@ void iq_inference_impl::process_tags_(COUNT_T in_first,
in_first, power_in)
}

void iq_inference_impl::pub_json_() {
json_result_type json;
while (json_q_.pop(json)) {
++predictions_;
message_port_pub(INFERENCE_KEY, string_to_pmt(std::string(json.data())));
}
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
int iq_inference_impl::general_work(int noutput_items,
Expand All @@ -481,13 +490,7 @@ int iq_inference_impl::general_work(int noutput_items,

process_tags_(in_first, samples_in_first, in_count, samples_in, power_in);
consume_each(in_count);

json_result_type json;
while (json_q_.pop(json)) {
++predictions_;
message_port_pub(INFERENCE_KEY, string_to_pmt(std::string(json.data())));
}

pub_json_();
return 0;
}
#pragma GCC diagnostic pop
Expand Down
1 change: 1 addition & 0 deletions lib/iq_inference_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class iq_inference_impl : public iq_inference, base_impl {
void delete_inference_();
void background_run_inference_();
void run_inference_();
void pub_json_();
boost::scoped_ptr<torchserve_client> torchserve_client_;

public:
Expand Down

0 comments on commit d091a53

Please sign in to comment.