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

Commit 06a3980

Browse files
author
Alan Shaw
authored
fix: populate in series (#443)
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 <alan.shaw@protocol.ai>
1 parent 447a6b2 commit 06a3980

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

src/pin/ls.js

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-env mocha */
22
'use strict'
33

4-
const parallel = require('async/parallel')
4+
const series = require('async/series')
55
const { fixtures } = require('./utils')
66
const { getDescribe, getIt, expect } = require('../utils/mocha')
77

@@ -30,19 +30,11 @@ module.exports = (createCommon, options) => {
3030
})
3131

3232
function populate () {
33-
parallel([
34-
(cb) => {
35-
ipfs.add(fixtures.files[0].data, { pin: false }, (err, res) => {
36-
if (err) return cb(err)
37-
ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb)
38-
})
39-
},
40-
(cb) => {
41-
ipfs.add(fixtures.files[1].data, { pin: false }, (err, res) => {
42-
if (err) return cb(err)
43-
ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
44-
})
45-
}
33+
series([
34+
cb => ipfs.add(fixtures.files[0].data, { pin: false }, cb),
35+
cb => ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb),
36+
cb => ipfs.add(fixtures.files[1].data, { pin: false }, cb),
37+
cb => ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
4638
], done)
4739
}
4840
})

src/pin/rm.js

+6-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-env mocha */
22
'use strict'
33

4-
const parallel = require('async/parallel')
4+
const series = require('async/series')
55
const { fixtures } = require('./utils')
66
const { getDescribe, getIt, expect } = require('../utils/mocha')
77

@@ -30,19 +30,11 @@ module.exports = (createCommon, options) => {
3030
})
3131

3232
function populate () {
33-
parallel([
34-
(cb) => {
35-
ipfs.add(fixtures.files[0].data, { pin: false }, (err, res) => {
36-
if (err) return cb(err)
37-
ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb)
38-
})
39-
},
40-
(cb) => {
41-
ipfs.add(fixtures.files[1].data, { pin: false }, (err, res) => {
42-
if (err) return cb(err)
43-
ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
44-
})
45-
}
33+
series([
34+
cb => ipfs.add(fixtures.files[0].data, { pin: false }, cb),
35+
cb => ipfs.pin.add(fixtures.files[0].cid, { recursive: true }, cb),
36+
cb => ipfs.add(fixtures.files[1].data, { pin: false }, cb),
37+
cb => ipfs.pin.add(fixtures.files[1].cid, { recursive: false }, cb)
4638
], done)
4739
}
4840
})

0 commit comments

Comments
 (0)