Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: populate in series (#443)
Browse files Browse the repository at this point in the history
Potential temporary fix for:

```
Error: EPERM: operation not permitted, rename 'C:\Users\travis\AppData\Local\Temp\ipfs-test-de2fc17f2aa28095e191f466fe8a6601\blocks\US\.3752.7204' -> 'C:\Users\travis\AppData\Local\Temp\ipfs-test-de2fc17f2aa28095e191f466fe8a6601\blocks\US\CIQPEUFLMK4TATXY3U6F7FNH33MIRA4KTFDAKY5ZKL7CCVQDQRIZUSQ.data'
```

This happens on the windows build in js-ipfs. Perhaps concurrent read/write is the issue?

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw authored Feb 19, 2019
1 parent 447a6b2 commit 06a3980
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
20 changes: 6 additions & 14 deletions src/pin/ls.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const parallel = require('async/parallel')
const series = require('async/series')
const { fixtures } = require('./utils')
const { getDescribe, getIt, expect } = require('../utils/mocha')

Expand Down Expand Up @@ -30,19 +30,11 @@ module.exports = (createCommon, options) => {
})

function populate () {
parallel([
(cb) => {
ipfs.add(fixtures.files[0].data, { pin: false }, (err, res) => {
if (err) return cb(err)
ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb)
})
},
(cb) => {
ipfs.add(fixtures.files[1].data, { pin: false }, (err, res) => {
if (err) return cb(err)
ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
})
}
series([
cb => ipfs.add(fixtures.files[0].data, { pin: false }, cb),
cb => ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb),
cb => ipfs.add(fixtures.files[1].data, { pin: false }, cb),
cb => ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
], done)
}
})
Expand Down
20 changes: 6 additions & 14 deletions src/pin/rm.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const parallel = require('async/parallel')
const series = require('async/series')
const { fixtures } = require('./utils')
const { getDescribe, getIt, expect } = require('../utils/mocha')

Expand Down Expand Up @@ -30,19 +30,11 @@ module.exports = (createCommon, options) => {
})

function populate () {
parallel([
(cb) => {
ipfs.add(fixtures.files[0].data, { pin: false }, (err, res) => {
if (err) return cb(err)
ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb)
})
},
(cb) => {
ipfs.add(fixtures.files[1].data, { pin: false }, (err, res) => {
if (err) return cb(err)
ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
})
}
series([
cb => ipfs.add(fixtures.files[0].data, { pin: false }, cb),
cb => ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb),
cb => ipfs.add(fixtures.files[1].data, { pin: false }, cb),
cb => ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
], done)
}
})
Expand Down

0 comments on commit 06a3980

Please sign in to comment.