[ARVADOS] updated: 1.3.0-821-gff875d9f7

Git user git at public.curoverse.com
Wed Apr 24 20:31:48 UTC 2019


Summary of changes:
 services/keep-balance/balance.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

       via  ff875d9f7ca4b04a40fa3205913db1b68ea00db3 (commit)
      from  0e6733b5009d22022c3b68bbd76b75ebdf5a12db (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit ff875d9f7ca4b04a40fa3205913db1b68ea00db3
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Apr 24 16:30:00 2019 -0400

    15112: Remove tempfile only if still locked (not renamed).
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/services/keep-balance/balance.go b/services/keep-balance/balance.go
index 33f3762b4..fc5812cde 100644
--- a/services/keep-balance/balance.go
+++ b/services/keep-balance/balance.go
@@ -83,7 +83,13 @@ func (bal *Balancer) Run(config Config, runOptions RunOptions) (nextRunOptions R
 		if err != nil {
 			return
 		}
-		defer os.Remove(tmpfn)
+		defer func() {
+			// Remove the tempfile only if we didn't get
+			// as far as successfully renaming it.
+			if lbFile != nil {
+				os.Remove(tmpfn)
+			}
+		}()
 		bal.lostBlocks = lbFile
 	} else {
 		bal.lostBlocks = ioutil.Discard
@@ -141,10 +147,7 @@ func (bal *Balancer) Run(config Config, runOptions RunOptions) (nextRunOptions R
 		if err != nil {
 			return
 		}
-		err = lbFile.Close()
-		if err != nil {
-			return
-		}
+		lbFile = nil
 	}
 	if runOptions.CommitPulls {
 		err = bal.CommitPulls(&config.Client)

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list