publish block before writing to disk
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Jul 13, 2015 at 11:24 UTC
a25352d80e14838308b9758662d2302fd75f228c
1 file changed
+2
-1
exchange/bitswap/bitswap.go
+2
-1
@@ -228,13 +228,14 @@ func (bs *Bitswap) HasBlock(ctx context.Context, blk *blocks.Block) error {
228
default:
229
}
230
231
+ bs.notifications.Publish(blk)
232
+
233
err := bs.tryPutBlock(blk, 4) // attempt to store block up to four times
234
if err != nil {
235
log.Errorf("Error writing block to datastore: %s", err)
236
return err
237
}
238
237
- bs.notifications.Publish(blk)
239
select {
240
case bs.newBlocks <- blk:
241
// send block off to be reprovided