Skip to content

Commit

Permalink
Always read the putBlockServer to completion.
Browse files Browse the repository at this point in the history
Partially fixez #270. The job is still erroring.
  • Loading branch information
jdoliner committed Apr 9, 2016
1 parent 3ba66a5 commit 0be417c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/server/pfs/server/local_block_api_server.go
Expand Up @@ -47,6 +47,13 @@ func newLocalBlockAPIServer(dir string) (*localBlockAPIServer, error) {
func (s *localBlockAPIServer) PutBlock(putBlockServer pfsclient.BlockAPI_PutBlockServer) (retErr error) {
result := &pfsclient.BlockRefs{}
defer func(start time.Time) { s.Log(nil, result, retErr, time.Since(start)) }(time.Now())
defer func() {
for {
if _, err := putBlockServer.Recv(); err != nil {
break
}
}
}()
scanner := bufio.NewScanner(protostream.NewStreamingBytesReader(putBlockServer))
for {
blockRef, err := s.putOneBlock(scanner)
Expand Down

0 comments on commit 0be417c

Please sign in to comment.