github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/docs/function-timeouts.md (about)

     1  # Function timeouts
     2  
     3  Within Function API, each functions supplied with 2 timeouts parameters, both optional, see [swagger.yaml](swagger.yml) for more details.
     4  So, what are those timeouts and what are they used for?
     5  
     6  ## Function call timeout
     7  
     8  This time of timeouts defines for how long function execution may happen before it'll be terminated along with notifying caller that function terminated with error - timed out.
     9  
    10  ```json
    11  {
    12  	"route":{
    13  	    ...
    14  		"timeout": 30,
    15  	    ...
    16  	}
    17  }
    18  ```
    19  
    20  This timeout parameter used with both types of functions: async and sync.
    21  It starts at the beginning of function call.
    22  
    23  ## Hot function idle timeout
    24  
    25  This type of timeout defines for how long should hot function hang around before its termination in case if there are no incoming requests.
    26  
    27  ```json
    28  {
    29  	"route":{
    30  	    ...
    31  		"idle_timeout": 30,
    32  	    ...
    33  	}
    34  }
    35  ```
    36  
    37  This timeout parameter is valid for hot functions, see what [hot functions](hot-functions.md) is. By default this parameter equals to 30 seconds.
    38  It starts after last request being processed by hot function.
    39  
    40  ## Correlation between idle and regular timeout
    41  
    42  This two timeouts are independent. The order of timeouts for hot functions:
    43  
    44   0. start hot function be sending first timeout-bound request to it
    45   1. make request to function with `timeout`
    46   2. if call finished (no matter successful or not) check for more requests to dispatch
    47   3. if none - start idle timeout
    48   4. if new request appears - stop idle timeout and serve request
    49   5. if none - terminate hot function
    50  
    51  ## Hot function idle timeout edge cases
    52  
    53  Having both timeouts may cause confusion while configuring hot function.
    54  So, there are certain limitations for `idle_timeout` as well as for regular `timeout`:
    55  
    56   * Idle timeout might be equal to zero. Such case may lead to satiation when function would be terminated immediately after last request processing, i.e. no idle timeout at all.
    57   * Idle timeout can't be negative.
    58   * Idle timeout can't be changed while hot function is running. Idle timeout is permanent within hot function execution lifecycle. It means that idle timeout should be considered for changing once functions is not running.