Skip to content

Job startup delay #836

@filex

Description

@filex

The jobs configure the interval. That is the duration between two invocations of the job. The first is "on startup" of Couper.

I had a situation, where I have a kube pod with two containers: Couper and a node-based API server. When the pod is rolled out, both containers start in parallel. Usually, Couper is faster and executes the jobs while the pod-local backend is not available yet. (This results in errors like cannot connect to http://localhost:3000).

The purpose of the execution on startup was, that the interval is not aligned (e.g. with 00:00 midnight). So instead of waiting for one interval before the first execution, we do it immediately. If the first execution is doomed to fail, we risk to maximize the time to the first job execution.

An easy solution could be to mitigate the problem is introduce a startup delay for the job:

job "init_cache" {
  interval = "1h"
  startup_delay = "1m"
  
  // requests  …
}

In this example, Couper would issue the first job 1 minute after startup. And thereafter, every hour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions