Skip to content

Commit 4ea8210

Browse files
obaudysgesellix
andcommitted
Apply suggestions from code review
Co-Authored-By: Tobias Gesellchen <[email protected]>
1 parent cdfa65b commit 4ea8210

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

couchdb-exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func init() {
127127
}),
128128
altsrc.NewUintFlag(cli.UintFlag{
129129
Name: "database.concurrent.requests",
130-
Usage: "maximum concurrent calls to couchDB, or 0 for unlimited",
130+
Usage: "maximum concurrent calls to CouchDB, or 0 for unlimited",
131131
Value: 0,
132132
Hidden: false,
133133
Destination: &exporterConfig.databaseConcurrentRequests,

lib/couchdb-client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ func (c *CouchdbClient) enhanceWithViewUpdateSeq(dbStatsByDbName map[string]Data
351351
for _, row := range designDocs.Rows {
352352
row := row
353353
go func() {
354-
defer func() { done <- struct{}{} }()
354+
defer func() {
355+
done <- struct{}{}
356+
}()
355357
updateSeqByView := make(ViewStats)
356358
type viewresult struct {
357359
viewName string
@@ -366,7 +368,7 @@ func (c *CouchdbClient) enhanceWithViewUpdateSeq(dbStatsByDbName map[string]Data
366368
err := semaphore.Acquire()
367369
if err != nil {
368370
// send something to parent coroutine so it doesn't block forever on receive
369-
v <- viewresult{err: fmt.Errorf("Aborted view stats for /%s/%s/_view/%s", dbName, row.Doc.Id, viewName)}
371+
v <- viewresult{err: fmt.Errorf("aborted view stats for /%s/%s/_view/%s", dbName, row.Doc.Id, viewName)}
370372
return
371373
}
372374
query := strings.Join([]string{
@@ -579,7 +581,7 @@ func NewSemaphore(concurrency uint) Semaphore {
579581
func (s Semaphore) Acquire() error {
580582
select {
581583
case <-s.abort:
582-
return fmt.Errorf("Could not acquire semaphore")
584+
return fmt.Errorf("could not acquire semaphore")
583585
case <-s.sem:
584586
return nil
585587
}
@@ -594,7 +596,7 @@ func (s Semaphore) Release() {
594596
}
595597
}
596598

597-
// Signal abort for anyone waiting on the Semaphor
599+
// Signal abort for anyone waiting on the Semaphore
598600
func (s Semaphore) Abort() {
599601
select {
600602
case <-s.abort:

lib/couchdb-client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestSerialSemaphore(t *testing.T) {
5555
}
5656
sem.Release()
5757
time.Sleep(20 * time.Millisecond)
58-
if len(results) > 20 { // should never complete this many in the alotted time
58+
if len(results) > 20 { // should never complete this many in the allotted time
5959
t.Error("Workers completed job too fast", len(results))
6060
}
6161
}

0 commit comments

Comments
 (0)