aboutsummaryrefslogtreecommitdiffstats
path: root/client/go/internal/vespa/document/dispatcher.go
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-03-27 10:17:16 +0200
committerMartin Polden <mpolden@mpolden.no>2023-03-27 10:17:53 +0200
commitabe8b5d6505a346b6b3afe62d83ac748314dfc77 (patch)
tree5700efad4fa3f7bf32f2fec410bd2eef2afa8030 /client/go/internal/vespa/document/dispatcher.go
parent8a603201778c1c6ebd1740827558a95dfcae48f4 (diff)
Continue feeding document group on failure
Matches vespa-feed-client behaviour.
Diffstat (limited to 'client/go/internal/vespa/document/dispatcher.go')
-rw-r--r--client/go/internal/vespa/document/dispatcher.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/client/go/internal/vespa/document/dispatcher.go b/client/go/internal/vespa/document/dispatcher.go
index feb562a241a..310e25c3837 100644
--- a/client/go/internal/vespa/document/dispatcher.go
+++ b/client/go/internal/vespa/document/dispatcher.go
@@ -21,7 +21,6 @@ type Dispatcher struct {
// documentGroup holds document operations which share their ID, and must be dispatched in order.
type documentGroup struct {
id Id
- failed bool
operations []documentOp
mu sync.Mutex
}
@@ -53,8 +52,8 @@ func NewDispatcher(feeder Feeder, workers int) *Dispatcher {
func (d *Dispatcher) dispatchAll(g *documentGroup) int {
g.mu.Lock()
defer g.mu.Unlock()
- failCount := len(g.operations)
- for i := 0; !g.failed && i < len(g.operations); i++ {
+ failCount := 0
+ for i := 0; i < len(g.operations); i++ {
op := g.operations[i]
ok := false
for op.attempts <= maxAttempts && !ok {
@@ -63,11 +62,8 @@ func (d *Dispatcher) dispatchAll(g *documentGroup) int {
result := d.feeder.Send(op.document)
ok = result.Status.Success()
}
- if ok {
- failCount--
- } else {
- g.failed = true
- failCount = len(g.operations) - i
+ if !ok {
+ failCount++
}
}
g.operations = nil