Process initializers¶
A process initializer runs when a sandbox process of your account starts, before it serves any of your code. It is the place for work which must exist in every process : a subscription to a message broker, a client kept for the life of the process, a warm cache.
| Page | API Info → Process Initializers : name, order, timeout in minutes, active, and the code. |
| Runs | In every sandbox process, when it starts ; the active initializers in the order given, one after the other. |
| Code | async function main(g: T.IAMGlobal), the same g as a custom API. |
| Test | Test API runs it on the API testing page. |
- Other code runs on an action : an HTTP call, a schedule, an event. An initializer runs on its own, once per process, so keep it light and idempotent.
- The number of sandbox processes is set on the Sandbox Settings page : each one runs the initializers.