Skip to content

Commit

Permalink
next tick before closing archive to avoid mem issues
Browse files Browse the repository at this point in the history
  • Loading branch information
joehand committed Jan 12, 2017
1 parent 85b5251 commit 6b26402
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/sync-owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,9 @@ test('sync-owner - turn off ignore hidden', function (t) {
var downloadDir = path.join(help.testFolder(), '' + Date.now())
mkdirp.sync(downloadDir)

Dat(downloadDir, { key: key }, function (err, tmpDat) {
Dat(downloadDir, { key: key }, function (err, downDat) {
if (err) throw err

downDat = tmpDat
downDat.joinNetwork()

downDat.network.swarm.once('connection', function () {
Expand All @@ -165,10 +164,12 @@ test('sync-owner - turn off ignore hidden', function (t) {
})
t.ok(hasHiddenFile.length, 'hidden file in archive')
downDat.network.swarm.close(function () {
downDat.close(function () {
rimraf(downDat.path, function () {
fs.unlink(hiddenFile, function () {
t.end()
process.nextTick(function () {
downDat.close(function () {
rimraf(downDat.path, function () {
fs.unlink(hiddenFile, function () {
t.end()
})
})
})
})
Expand Down

0 comments on commit 6b26402

Please sign in to comment.