Init services

Init services are commands and functions running all the time. If it crashes, it is reloaded.

They will be loaded at plugin activation, and stopped when plugin is no longer active.

If the function returns it will be called again. If the service keeps failing it may not be called again in some time, but eventually will be called again.

If exits with a failure (exception, or fatal crash), the command/call will be called again in increasing timeouts, decreased by running time: on each fail it will wait double time (max 30m), but for each second running it removes a second for next wait.

If the called method returns with a number, that the number of seconds to wait until next run. In this case the command will be stopped with normal cmd stop rules: if its a singleton will not be stopped at all, if one_for_one it will be stopped.

Manifest YAML component definition

  - name: Telegram checker
    id: init
    type: init
    command: telegram/daemon
    call: check_for_new_messages
Field Description
type init
command Service cmd to execute.
call Method to call at the command

The command will be shared between callers, as normal, so if your init requires another running instance of your program, use one_for_one at the command or another cmd service.