[ https://issues.apache.org/jira/browse/THRIFT-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brandon Mitchell updated THRIFT-1085: ------------------------------------- Attachment: patch.diff Attached is a sample implementation for consideration. > Provide higher-level timeouts > ----------------------------- > > Key: THRIFT-1085 > URL: https://issues.apache.org/jira/browse/THRIFT-1085 > Project: Thrift > Issue Type: New Feature > Components: Ruby - Library > Affects Versions: 0.7 > Reporter: Brandon Mitchell > Priority: Minor > Attachments: patch.diff > > > The timeout used by the Socket transport applies per read/write. Either in > addition to or in lieu of these per-syscall timeouts, we would like a way to > provide a higher-level, per message timeout which may span multiple > read/write calls. > For example, with a simple service defined like: > {noformat} > service Echo { > string echo(1: string s) > } > {noformat} > The generated client will look something like: > {noformat} > module Echo > class Client > include ::Thrift::Client > def echo(s) > send_echo(s) > return recv_echo() > end > def send_echo(s) > send_message('echo', Echo_args, :s => s) > end > def recv_echo() > result = receive_message(Echo_result) > return result.success unless result.success.nil? > raise > ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, > 'echo failed: unknown result') > end > end > end > {noformat} > As the code is written now, if the timeout for Echo::Client#echo is defined > as 1 second, it is possible for up to *2* seconds to pass in a single call. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira