17574: Fix misleading errors after reaching update limit.
authorTom Clegg <tom@curii.com>
Thu, 29 Jul 2021 03:45:23 +0000 (23:45 -0400)
committerTom Clegg <tom@curii.com>
Thu, 29 Jul 2021 03:45:23 +0000 (23:45 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

services/keep-balance/collection.go

index 575aa0c39c265eb64e79671b20b949f72a5cee98..1da3ec4415946bea6e3176f6746a2229a5017443 100644 (file)
@@ -163,7 +163,7 @@ func (bal *Balancer) updateCollections(ctx context.Context, c *arvados.Client, c
                        txPending := 0
                        flush := func(final bool) error {
                                err := tx.Commit()
-                               if err != nil {
+                               if err != nil && ctx.Err() == nil {
                                        tx.Rollback()
                                        return err
                                }
@@ -221,7 +221,7 @@ func (bal *Balancer) updateCollections(ctx context.Context, c *arvados.Client, c
                                        where uuid=$4`,
                                        repl, thresholdStr, classes, coll.UUID)
                                if err != nil {
-                                       if err != context.Canceled {
+                                       if ctx.Err() == nil {
                                                bal.logf("%s: update failed: %s", coll.UUID, err)
                                        }
                                        continue