Many service perform time-consuming jobs like generating a PDF report, sending an e-mail, rendering a video, etc. Performing all these jobs in sequence when handling an HTTP request increases the response time and negatively impacts the user's experience.
To keep your service snappy, you can attach a job queue to your service. This allows you to push these time-consuming jobs onto a queue to be processed asynchronously by a background worker.
To configure a job queue in your code editor, use the following variables in the service's configuration as code file.
# service: ...
job_queues:
- name: jobs
timeout: 300
The name of the job queue must use snake_case notation. In addition, job queues within a service cannot share the same name.
The number of times the execution of the job is automatically retried after a failure.
0
5
0
The number of seconds after which the execution of the job times out.
10
600
30
The path of the endpoint that is called by the job queue to execute a job.
/shipmate/handle-job