From 44b5b6ffbf8b8c3da4b320b029eb50b6c213836a Mon Sep 17 00:00:00 2001 From: Michael Davis <michael.davis@cern.ch> Date: Fri, 24 Nov 2017 09:51:12 +0100 Subject: [PATCH] [xrd_ssi] Removes timeout handling from promise in RequestProc We now assume that Finished() will always be called, so explicit timeout handling in RequestProc is redundant. In case of successful Request processing, the XRootD framework will call Finished(cancel=false). In the case of a failure or timeout, the framework will call Finished(cancel=true). --- xroot_ssi_pb/XrdSsiPbRequestProc.hpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/xroot_ssi_pb/XrdSsiPbRequestProc.hpp b/xroot_ssi_pb/XrdSsiPbRequestProc.hpp index 87f0f812bc..14cde8de17 100644 --- a/xroot_ssi_pb/XrdSsiPbRequestProc.hpp +++ b/xroot_ssi_pb/XrdSsiPbRequestProc.hpp @@ -135,10 +135,6 @@ private: template <typename RequestType, typename MetadataType, typename AlertType> void RequestProc<RequestType, MetadataType, AlertType>::Execute() { - const int ExecuteTimeout = 600; //< Maximum no. of seconds to wait before deleting myself - //< What is a sensible number? Does it need to be configurable? - //< In any case it should be <= timeout on the client side? - #ifdef XRDSSI_DEBUG std::cerr << "[DEBUG] RequestProc::Execute()" << std::endl; #endif @@ -191,14 +187,7 @@ void RequestProc<RequestType, MetadataType, AlertType>::Execute() auto finished = m_promise.get_future(); - if(finished.wait_for(std::chrono::seconds(ExecuteTimeout)) == std::future_status::timeout) - { - throw XrdSsiException("RequestProc::Finished() was never called!"); - - // Should call Finished(true) instead of throwing an exception, waiting for Andy to comment on - // whether the handling of Finished() is reentrant in the framework, or whether the application - // has to manage it. - } + finished.wait(); } @@ -221,7 +210,10 @@ void RequestProc<RequestType, MetadataType, AlertType>::Finished(XrdSsiRequest & if(cancel) { - // Reclaim resources dedicated to the request and then tell caller the request object can be reclaimed. + // Reclaim resources dedicated to the request and tell caller the request object can be reclaimed +#ifdef XRDSSI_DEBUG + std::cerr << "[DEBUG] Request timed out or was cancelled" << std::endl; +#endif } else { @@ -229,7 +221,6 @@ void RequestProc<RequestType, MetadataType, AlertType>::Finished(XrdSsiRequest & } // Tell Execute() that we have Finished() - m_promise.set_value(); } -- GitLab