Refine the draft timeout control from server side.

This commit is contained in:
Adam Gu
2018-04-12 09:21:04 +08:00
parent fb37d759a0
commit 919fa54a98
6 changed files with 12 additions and 88 deletions
@@ -3,8 +3,6 @@
#include <list>
#include "boost/lexical_cast.hpp"
#include "boost/thread.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"
////////////////////////////////////////////////////////////////////////////////
@@ -115,10 +113,6 @@ bool BookListService::Handle(const std::string& http_method,
std::string* response_content) {
if (http_method == webcc::kHttpGet) {
*response_content = CreateBookListJson(g_book_store.books());
// Sleep for testing timeout control.
//boost::this_thread::sleep(boost::posix_time::seconds(2));
return true;
}
@@ -146,9 +140,6 @@ bool BookDetailService::Handle(const std::string& http_method,
*response_content = CreateBookJson(book);
// Sleep for testing timeout control.
//boost::this_thread::sleep(boost::posix_time::seconds(2));
return true;
} else if (http_method == webcc::kHttpPost) {
-5
View File
@@ -27,11 +27,6 @@ int main(int argc, char* argv[]) {
server.RegisterService(std::make_shared<BookDetailService>(),
"/books/(\\d+)");
// For test purpose.
// Timeout like 60s makes more sense in a real product.
// Leave it as default (0) for no timeout control.
server.set_timeout_seconds(1);
server.Run();
} catch (std::exception& e) {