go/trains: ease up on some crashy behaviour
This commit is contained in:
parent
ec5af85046
commit
5f0326b484
2 changed files with 12 additions and 3 deletions
|
@ -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")
|
||||
|
|
|
@ -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 :(")
|
||||
|
|
Loading…
Reference in a new issue