|
|
@@ -33,8 +33,6 @@ import (
|
|
|
pbv1 "git3.techno-world.net/lrosales/broad-announce/gen/go/broadannounce/v1"
|
|
|
"git3.techno-world.net/lrosales/broad-announce/internal/alert"
|
|
|
"git3.techno-world.net/lrosales/broad-announce/loadgen/internal/pacer"
|
|
|
- "google.golang.org/grpc/codes"
|
|
|
- "google.golang.org/grpc/status"
|
|
|
)
|
|
|
|
|
|
type workerResult struct {
|
|
|
@@ -208,19 +206,12 @@ func runWorker(
|
|
|
case <-tickCh:
|
|
|
a := mkAlert("normal", companyFromKey(apiKey), sourceID, dedupePct, dedupeKey, payloadB)
|
|
|
if err := stream.Send(prodCtx, alertToProto(companyFromKey(apiKey), sourceID, a)); err != nil {
|
|
|
- // Check if it's a retriable error.
|
|
|
- st, _ := status.FromError(err)
|
|
|
- if st.Code() == codes.ResourceExhausted || st.Code() == codes.Unavailable {
|
|
|
- // Retry with backoff.
|
|
|
- time.Sleep(5 * time.Millisecond)
|
|
|
- if err := stream.Send(prodCtx, alertToProto(companyFromKey(apiKey), sourceID, a)); err != nil {
|
|
|
- res.failed++
|
|
|
- return
|
|
|
- }
|
|
|
- } else {
|
|
|
- res.failed++
|
|
|
- return
|
|
|
- }
|
|
|
+ // stream.Send (loadgen wrapper) already retries 3x on
|
|
|
+ // retriable codes. Treat any error here as terminal
|
|
|
+ // for this tick. Counter + exit.
|
|
|
+ logger.Error("send failed", "err", err)
|
|
|
+ res.failed++
|
|
|
+ return
|
|
|
}
|
|
|
ackCh <- pendingAck{sentAt: time.Now(), dk: a.DedupeKey}
|
|
|
i++
|