Eliminate useless unordered_set

I don't know what this set was originally meant to be doing, but it
currently does nothing (except adding overhead).

The comment says it "owns" the instances but that isn't really true; the
instances effectively already manage themselves as they pass the pointer
through the communications between proxy and workers.
This commit is contained in:
Jason Rhinelander 2022-05-12 12:25:46 -03:00
parent 3a51713396
commit 371606cde0
No known key found for this signature in database
GPG Key ID: C4992CE7A88D4262
3 changed files with 0 additions and 6 deletions

View File

@ -5,7 +5,6 @@
namespace oxenmq {
void OxenMQ::proxy_batch(detail::Batch* batch) {
batches.insert(batch);
const auto [jobs, tagged_threads] = batch->size();
OMQ_TRACE("proxy queuing batch job with ", jobs, " jobs", tagged_threads ? " (job uses tagged thread(s))" : "");
if (!tagged_threads) {
@ -37,7 +36,6 @@ void OxenMQ::job(std::function<void()> f, std::optional<TaggedThreadID> thread)
void OxenMQ::proxy_schedule_reply_job(std::function<void()> f) {
auto* j = new Job(std::move(f));
reply_jobs.emplace_back(static_cast<detail::Batch*>(j), 0);
batches.insert(j);
proxy_skip_one_poll = true;
}
@ -113,7 +111,6 @@ void OxenMQ::_queue_timer_job(int timer_id) {
} else {
b = new Job(func, thread);
}
batches.insert(b);
OMQ_TRACE("b: ", b->size().first, ", ", b->size().second, "; thread = ", thread);
assert(b->size() == std::make_pair(size_t{1}, thread > 0));
auto& queue = thread > 0

View File

@ -576,8 +576,6 @@ private:
/// weaker (i.e. it cannot reconnect to the SN if the connection is no longer open).
void proxy_reply(oxenc::bt_dict_consumer data);
/// Currently active batch/reply jobs; this is the container that owns the Batch instances
std::unordered_set<detail::Batch*> batches;
/// Individual batch jobs waiting to run; .second is the 0-n batch number or -1 for the
/// completion job
using batch_job = std::pair<detail::Batch*, int>;

View File

@ -247,7 +247,6 @@ void OxenMQ::proxy_worker_message(std::vector<zmq::message_t>& parts) {
}
if (clear_job) {
batches.erase(batch);
delete batch;
run.to_run = static_cast<detail::Batch*>(nullptr);
}