Skip to content

Commit 903730a

Browse files
committed
tweaks
1 parent da4576d commit 903730a

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ metaURI: mongodb://localhost:28012
7878
1. After launching the verifier (see above), you can send it requests to get it to start verifying. The verification process is started by using the `check`command. An [optional `filter` parameter](#document-filtering) can be passed within the `check` request body to only check documents within that filter. The verification process will keep running until you tell the verifier to stop. It will keep track of the inconsistencies it has found and will keep checking those inconsistencies hoping that eventually they will resolve.
7979

8080
```
81-
curl -H "Content-Type: application/json" -X POST -d '{}' http://127.0.0.1:27020/api/v1/check
81+
curl -H "Content-Type: application/json" -d '{}' http://127.0.0.1:27020/api/v1/check
8282
```
8383
8484

internal/verifier/check.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,9 @@ func (verifier *Verifier) Work(ctx context.Context, workerNum int, wg *sync.Wait
357357
default:
358358
task, err := verifier.FindNextVerifyTaskAndUpdate()
359359
if errors.Is(err, mongo.ErrNoDocuments) {
360-
verifier.logger.Debug().Msgf("[Worker %d] No tasks found, sleeping...", workerNum)
361-
time.Sleep(verifier.workerSleepDelayMillis * time.Millisecond)
360+
delay := verifier.workerSleepDelayMillis * time.Millisecond
361+
verifier.logger.Debug().Msgf("[Worker %d] No tasks found, sleeping %s...", workerNum, delay)
362+
time.Sleep(delay)
362363
continue
363364
} else if err != nil {
364365
panic(err)

internal/verifier/summary.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
"golang.org/x/exp/maps"
2020
)
2121

22+
const changeEventsTableMaxSize = 10
23+
2224
// NOTE: Each of the following should print one trailing and one final
2325
// newline.
2426

@@ -407,7 +409,9 @@ func (verifier *Verifier) printChangeEventStatistics(builder *strings.Builder) {
407409
)
408410

409411
// Only report the busiest namespaces.
410-
sortedNamespaces = sortedNamespaces[:10]
412+
if len(sortedNamespaces) > changeEventsTableMaxSize {
413+
sortedNamespaces = sortedNamespaces[:changeEventsTableMaxSize]
414+
}
411415

412416
table := tablewriter.NewWriter(builder)
413417
table.SetHeader([]string{"Namespace", "Insert", "Update", "Replace", "Delete", "Total"})

0 commit comments

Comments
 (0)