Merge pull request #433 from crazybuster/await-on-send

Wait for send to complete on exchange heads
This commit is contained in:
Haad 2018-08-16 17:12:21 +03:00 committed by GitHub
commit eafc95805f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ const exchangeHeads = async (ipfs, address, peer, getStore, getDirectConnection,
const heads = getHeadsForDatabase(getStore(address))
logger.debug(`Send latest heads of '${address}':\n`, JSON.stringify(heads.map(e => e.hash), null, 2))
if (heads) {
channel.send(JSON.stringify({ address: address, heads: heads }))
await channel.send(JSON.stringify({ address: address, heads: heads }))
}
return channel