AWS.Lambda.Runtime (AWS Lambda Runtime v0.1.1)

View Source

The custom runtime loop.

Started as a permanent Task by the application supervisor. The lifecycle is:

  1. start the :httpc profile and resolve the handler (initialisation — any failure here is reported to /runtime/init/error and halts the VM);
  2. long-poll GET /runtime/invocation/next, which is where the sandbox is frozen between invocations;
  3. run the handler in a supervised task bounded by the invocation deadline;
  4. post the result to /response or the failure to /error;
  5. go back to step 2 with the VM still warm.

Handler failures never crash this process, so a warm sandbox survives a bad invocation and the next one avoids a cold start.

Summary

Functions

Returns a specification to start this module under a supervisor.

Entry point invoked by start_link/1 through Task.start_link/3.

Starts the runtime loop as a supervised, permanently-restarted Task.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

arg is passed as the argument to Task.start_link/1 in the :start field of the spec.

For more information, see the Supervisor module, the Supervisor.child_spec/2 function and the Supervisor.child_spec/0 type.

run(opts)

Entry point invoked by start_link/1 through Task.start_link/3.

Not meant to be called directly — resolves the handler, then loops forever.

start_link(opts \\ [])

Starts the runtime loop as a supervised, permanently-restarted Task.