Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

track enqueued and dequeued stat

  • Loading branch information...
commit 753191c73562dd5754465b1446248ffb34d1baf2 1 parent b42fea7
@erikfrey erikfrey authored
Showing with 3 additions and 1 deletion.
  1. +1 −1  include/darner/util/stats.hpp
  2. +2 −0  src/net/handler.cpp
View
2  include/darner/util/stats.hpp
@@ -31,7 +31,7 @@ struct stats
out << "STAT uptime " << (now - alive_since).total_seconds() << "\r\n";
out << "STAT time " << (now - epoch).total_seconds() << "\r\n";
out << "STAT version " << DARNER_VERSION << "\r\n";
- out << "STAT curr_items " << items_dequeued - items_enqueued << "\r\n";
+ out << "STAT curr_items " << (items_enqueued > items_dequeued ? items_enqueued - items_dequeued : 0) << "\r\n";
out << "STAT total_items " << items_enqueued << "\r\n";
out << "STAT curr_connections " << conns_opened - conns_closed << "\r\n";
out << "STAT total_connections " << conns_opened << "\r\n";
View
2  src/net/handler.cpp
@@ -157,6 +157,7 @@ void handler::set_on_read_chunk(const system::error_code& e, size_t bytes_transf
if (push_stream_->tell() == req_.num_bytes) // are we all done?
{
push_stream_.reset();
+ ++stats_.items_enqueued;
return done(true, "STORED\r\n");
}
@@ -269,6 +270,7 @@ void handler::get_on_write_chunk(const boost::system::error_code& e, size_t byte
}
pop_stream_.reset();
}
+ ++stats_.items_dequeued;
return done(true, "\r\nEND\r\n");
}
else
Please sign in to comment.
Something went wrong with that request. Please try again.