From 6a4eff5b842d652f3c8d7146f8fc0e4353709c38 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 2 Feb 2013 21:50:03 -0800 Subject: [PATCH] schema: make serverHasBlob just use blobserver.StatBlob Change-Id: I3012763660c9ed87eb48b2d95b8265c3c77f32df --- pkg/schema/filewriter.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/schema/filewriter.go b/pkg/schema/filewriter.go index 1dc7a9c26..f50c5c7f8 100644 --- a/pkg/schema/filewriter.go +++ b/pkg/schema/filewriter.go @@ -22,6 +22,7 @@ import ( "fmt" "io" "log" + "os" "strings" "camlistore.org/pkg/blobref" @@ -137,13 +138,11 @@ func writeFileMapOld(bs blobserver.StatReceiver, file *Builder, r io.Reader) (*b } func serverHasBlob(bs blobserver.BlobStatter, br *blobref.BlobRef) (have bool, err error) { - ch := make(chan blobref.SizedBlobRef, 1) - go func() { - err = bs.StatBlobs(ch, []*blobref.BlobRef{br}, 0) - close(ch) - }() - for _ = range ch { + _, err = blobserver.StatBlob(bs, br) + if err == nil { have = true + } else if err == os.ErrNotExist { + err = nil } return }