Skip to content

Commit

Permalink
chore: feat tslint
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelramalho19 committed Nov 10, 2020
1 parent 6860cf0 commit 3f5c51b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/bundles/files/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,15 @@ const actions = () => ({
doPinsSizeGet: () => perform(ACTIONS.PINS_SIZE_GET, async (ipfs) => {
const allPinsCids = await ipfs.pin.ls({ type: 'recursive' })

let size = 0
let pinsSize = 0
let numberOfPins = 0

for await (const { cid } of allPinsCids) {
size += (await ipfs.files.stat(`/ipfs/${cid.toString()}`)).cumulativeSize
pinsSize += (await ipfs.files.stat(`/ipfs/${cid.toString()}`)).cumulativeSize
numberOfPins++
}

return { size, numberOfPins }
return { pinsSize, numberOfPins }
}),

/**
Expand Down
2 changes: 2 additions & 0 deletions src/bundles/files/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ export const IGNORED_FILES = [
export const DEFAULT_STATE = {
pageContent: null,
mfsSize: -1,
pinsSize: 0,
numberOfPins: 0,
pins: [],
sorting: { // TODO: cache this
by: SORTING.BY_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/bundles/files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default () => {
case ACTIONS.PINS_SIZE_GET: {
const { task, type } = action
const pinsSize = task.status === 'Exit' && task.result.ok
? task.result.value.size
? task.result.value.pinsSize
: 0

const numberOfPins = task.status === 'Exit' && task.result.ok
Expand Down
2 changes: 2 additions & 0 deletions src/bundles/files/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type Model = {
pins: string[]
sorting: Sorting
mfsSize: number
pinsSize: number
numberOfPins: number

pending: PendingJob<any, any>[]
finished: FinishedJob<any>[]
Expand Down

0 comments on commit 3f5c51b

Please sign in to comment.