Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit 7c4d752

Browse files
committed
refactor(elasticsearch): ignore errors on log
1 parent 83b7863 commit 7c4d752

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/elasticsearch/elasticsearch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (d recordDatabase) Insert(records []*models.ElasticRecord) (*InsertResponse
6767
defer cancel()
6868
res, err := bulkRequest.Do(ctx)
6969
if err == elastic.ErrNoClient || errors.Cause(err) == elastic.ErrNoClient {
70-
level.Warn(d.logger).Log("message", "no elasticsearch node available", "err", err)
70+
_ = level.Warn(d.logger).Log("message", "no elasticsearch node available", "err", err)
7171
return &InsertResponse{AlreadyExists: nil, Retry: records, Backoff: true}, nil
7272
}
7373
if err != nil {

src/elasticsearch/elasticsearch_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestRecordDatabase_Insert(t *testing.T) {
8282
}
8383
res, err := db.GetClient().Get().Index(record.Index).Type(record.Type).Id(record.ID).Do(context.Background())
8484
if assert.NoError(t, err) {
85-
json.Unmarshal(res.Source, &recordFromES)
85+
_ = json.Unmarshal(res.Source, &recordFromES)
8686
}
8787
assert.Equal(t, recordFromES.Id, id)
8888
}
@@ -104,7 +104,7 @@ func TestRecordDatabase_Insert_RepeatedId(t *testing.T) {
104104
}
105105
res, err := db.GetClient().Get().Index(record.Index).Type(record.Type).Id(record.ID).Do(context.Background())
106106
if assert.NoError(t, err) {
107-
json.Unmarshal(res.Source, &recordFromES)
107+
_ = json.Unmarshal(res.Source, &recordFromES)
108108
}
109109
assert.Equal(t, recordFromES.Id, id)
110110
}
@@ -123,7 +123,7 @@ func TestRecordDatabase_Insert_Multiple(t *testing.T) {
123123
}
124124
res, err := db.GetClient().Get().Index(record.Index).Type(record.Type).Id(record.ID).Do(context.Background())
125125
if assert.NoError(t, err) {
126-
json.Unmarshal(res.Source, &recordFromES)
126+
_ = json.Unmarshal(res.Source, &recordFromES)
127127
}
128128
assert.Equal(t, recordFromES.Id, id)
129129
}

0 commit comments

Comments
 (0)