~egtann/sjs

af2484bba3186c82baee964a01896820cde8aecc — Evan Tann 1 year, 11 months ago 0a9996f
add client timeout

Expect a client to respond with 200 OK in less than 10 seconds, even if
the job may take much longer.
1 files changed, 1 insertions(+), 1 deletions(-)

M worker.go
M worker.go => worker.go +1 -1
@@ 186,7 186,7 @@ func (w *Worker) Run(ctx context.Context, j *Job) error {
	req = req.WithContext(ctx)
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("X-API-Key", w.APIKey)
	client := &http.Client{}
	client := &http.Client{Timeout: 10 * time.Second}
	resp, err := client.Do(req)
	if err != nil {
		return errors.Wrap(err, "post")