Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
saurav-malani committed Nov 8, 2022
1 parent 90ee22d commit 1beba87
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion regulation-worker/cmd/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ func TestFlow(t *testing.T) {
insertMinioData(t)
t.Log("Minio server is up and running")


// starting http server to mock regulation-manager
srv := httptest.NewServer(handler(t))
t.Cleanup(srv.Close)
Expand Down
4 changes: 2 additions & 2 deletions regulation-worker/internal/delete/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"strings"

Expand Down Expand Up @@ -60,7 +60,7 @@ func (api *APIManager) Delete(ctx context.Context, job model.Job, destConfig map

resp, err := api.Client.Do(req)
if err != nil {
if errors.Is(err, context.DeadlineExceeded) {
if err, ok := err.(net.Error); ok && err.Timeout() {
stats.Default.NewStat("regulation_worker_delete_api_timeout", stats.CountType).Count(1)
}
return model.JobStatusFailed
Expand Down
2 changes: 1 addition & 1 deletion regulation-worker/internal/service/looper.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (l *Looper) Loop(ctx context.Context) error {
}
continue
}
//this is to make sure that we don't panic when any of the API call fails with deadline exceeded error.
// this is to make sure that we don't panic when any of the API call fails with deadline exceeded error.
if err == model.ErrRequestTimeout {
pkgLogger.Errorf("context deadline exceeded... retrying after a minute %v", err)
if err := misc.SleepCtx(ctx, time.Duration(retryDelay)*time.Minute); err != nil {
Expand Down

0 comments on commit 1beba87

Please sign in to comment.