Skip to content

Commit a25352d

Browse files
committedJul 13, 2015
publish block before writing to disk
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
1 parent 7ef1a47 commit a25352d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎exchange/bitswap/bitswap.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
228228
default:
229229
}
230230

231+
bs.notifications.Publish(blk)
232+
231233
err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times
232234
if err != nil {
233235
log.Errorf("Error writing block to datastore: %s", err)
234236
return err
235237
}
236238

237-
bs.notifications.Publish(blk)
238239
select {
239240
case bs.newBlocks <- blk:
240241
// send block off to be reprovided

0 commit comments

Comments
 (0)
Please sign in to comment.