From 5f0326b48439be974073d922743da7a044204725 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Tue, 7 Dec 2021 15:19:29 +0000 Subject: [PATCH] go/trains: ease up on some crashy behaviour --- go/trains/darwin/darwindb/ddbtrainstatus.go | 5 ++++- go/trains/darwin/darwingest/darwingest.go | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/go/trains/darwin/darwindb/ddbtrainstatus.go b/go/trains/darwin/darwindb/ddbtrainstatus.go index 9e3297d803..ba4dc1f375 100644 --- a/go/trains/darwin/darwindb/ddbtrainstatus.go +++ b/go/trains/darwin/darwindb/ddbtrainstatus.go @@ -120,8 +120,11 @@ RETURNING id, effective_start_time return fmt.Errorf("RID %v/my ID %v at TIPLOC %v: failed to update with query %q: %w", ts.RID, tsid, l.TIPLOC, query, err) } a.TIPLOC(l.TIPLOC) - if cmd.RowsAffected() != 1 { + if cmd.RowsAffected() > 1 { return fmt.Errorf("RID %v/my ID %v at TIPLOC %v: query %q: wanted to update 1 row, updated %d", ts.RID, tsid, l.TIPLOC, query, cmd.RowsAffected()) + } else if cmd.RowsAffected() == 0 { + log.Printf("RID %v/my ID %v at TIPLOC %v: query %q: wanted to update 1 row, updated %d", ts.RID, tsid, l.TIPLOC, query, cmd.RowsAffected()) + // non-fatal :(( } } fmt.Printf("t") diff --git a/go/trains/darwin/darwingest/darwingest.go b/go/trains/darwin/darwingest/darwingest.go index 70553803c4..266db9c2c7 100644 --- a/go/trains/darwin/darwingest/darwingest.go +++ b/go/trains/darwin/darwingest/darwingest.go @@ -252,11 +252,17 @@ func run(ctx context.Context, bucket *blob.Bucket, cfg Config, runCatchup bool) var err error log.Printf("resubscribing...") - sub, err = cfg.StompSubscribe(ctx, stompConn) + if stompConn != nil { + sub, err = cfg.StompSubscribe(ctx, stompConn) + } else { + err = fmt.Errorf("no stompConn") + } if err != nil { log.Printf("StompSubscribe while resubscribing: %v", err) // Force close the server connection and dial again. - stompConn.MustDisconnect() + if stompConn != nil { + stompConn.MustDisconnect() + } stompConn, err = cfg.DialStomp(ctx) if err != nil { log.Printf("DialStomp failed as well :(")