From c7643fb5da92cbc032376d4c838faf93cab81452 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Tue, 2 Jul 2019 09:21:26 -0400 Subject: [PATCH] check blocklist first, its cheaper --- store/dbbacked.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/store/dbbacked.go b/store/dbbacked.go index eb35777..528fe37 100644 --- a/store/dbbacked.go +++ b/store/dbbacked.go @@ -107,13 +107,13 @@ func (d *DBBackedS3Store) Block(hash string) error { // Wants returns false if the hash exists or is blocked, true otherwise func (d *DBBackedS3Store) Wants(hash string) (bool, error) { - has, err := d.Has(hash) - if has || err != nil { + blocked, err := d.isBlocked(hash) + if blocked || err != nil { return false, err } - blocked, err := d.isBlocked(hash) - return !blocked, err + has, err := d.Has(hash) + return !has, err } // MissingBlobsForKnownStream returns missing blobs for an existing stream