<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.setTransactionTimeLimit.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.setTransactionTimeLimit</api:function-name><api:suggest>xdmp.settransactiontimelimit</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>settransactiontimelimit</api:suggest><api:function-link mode="xquery" fullname="xdmp:set-transaction-time-limit">/apidoc/8.0/xdmp:set-transaction-time-limit.xml</api:function-link><api:function mode="javascript" name="setTransactionTimeLimit" type="builtin" lib="xdmp" category="TransactionBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.setTransactionTimeLimit"><api:summary>
  Set the transaction time limit for a local or remote transaction.
  Defaults to the configured request timeout.
</api:summary><api:params><api:param name="time-limit" type="xs:unsignedInt"><api:param-description>
    The desired time limit, in seconds.
  </api:param-description><api:param-name>time-limit</api:param-name><api:param-type>Number</api:param-type></api:param><api:param name="host-id" type="xs:unsignedLong" optional="true"><api:param-description>
    An optional host ID. If omitted, the local App Server host is assumed.
    If a host ID is given, then a transaction ID must also be given.
  </api:param-description><api:param-name>host-id</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="txn-id" type="xs:unsignedLong" optional="true"><api:param-description>
    An optional transaction ID. If omitted, the current transaction is
    assumed. If a transaction ID is given, then a host ID must also be given.
  </api:param-description><api:param-name>txn-id</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>null</api:return><api:privilege>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-set-transaction-time-limit-my</code></p>
  <p xmlns="http://www.w3.org/1999/xhtml"><code>http://marklogic.com/xdmp/privileges/xdmp-set-transaction-time-limit-any</code></p>
</api:privilege><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">
     The transaction time limit determines how long the transaction may run
     before being automatically aborted. If you set the time limit to a limit
     less than the elapsed time of the current transaction, the transaction
     may abort immediately.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     The default (and maximum) transaction time limit is the request time
     limit configured for the server that creates the transaction. For
     information on configuring the request time limit, see the Administrator's
     Guide, or <code><a href="./admin:appserver-set-request-timeout">
     admin:appserver-set-request-timeout</a></code>.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     If you attempt to set the transaction time limit to a value greater
     than the configured request time limit, the exception
     <code>XDMP-TIMELIMIT</code> is raised.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     Changing any time limits on a request, even  if it happens in an eval 
     or an invoke that is inside the original request, affects the whole 
     request; that is, the timeouts affect the entire App Server request.  
     Therefore, if you set the limit lower on an eval or an invoke within an 
     outer App Server request, that new timeout is used for the entire 
     request.
  </p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.setTransactionTimeLimit(10);
=&gt; Empty. The time limit of the current transaction on the
   local host is set to 10 seconds.
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
xdmp.setTransactionTimeLimit(10, xdmp.host(), some-txn-id);
=&gt; Empty. The time limit of the given transaction on the local
   host is set to 10 seconds.
</pre></api:example></api:function></api:function-page>