Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ipfs-images-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ipfs-images
ipfs-images-components
Commits
03e99b2a
Commit
03e99b2a
authored
Feb 19, 2018
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean attachments sequentially
parent
55e7be0c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
cleaner.js
components/cleaner.js
+7
-10
No files found.
components/cleaner.js
View file @
03e99b2a
...
@@ -69,12 +69,12 @@ class Cleaner {
...
@@ -69,12 +69,12 @@ class Cleaner {
let
metadata
=
new
Metadata
();
let
metadata
=
new
Metadata
();
return
Promise
.
join
(
return
Promise
.
join
(
metadata
.
delRecord
(
hash
),
ipfs
.
unpin
(
hash
)
ipfs
.
unpin
(
hash
)
).
then
(()
=>
{
).
then
(()
=>
{
logging
.
info
(
`Successfully deleted attachment
${
hash
}
`
);
logging
.
info
(
`Successfully unpinned attachment
${
hash
}
`
);
}).
catch
((
error
)
=>
{
return
metadata
.
delRecord
(
hash
);
logging
.
error
(
error
);
}).
then
(()
=>
{
logging
.
info
(
`Deleted metadata for
${
hash
}
`
);
});
});
}
}
...
@@ -102,12 +102,9 @@ class Cleaner {
...
@@ -102,12 +102,9 @@ class Cleaner {
let
ipfs
=
new
Ipfs
();
let
ipfs
=
new
Ipfs
();
let
metadata
=
new
Metadata
();
let
metadata
=
new
Metadata
();
return
Promise
.
map
(
list
,
(
hash
)
=>
{
return
Promise
.
mapSeries
(
list
,
(
hash
)
=>
return
Promise
.
join
(
this
.
delAttachment
(
hash
)
metadata
.
delRecord
(
hash
),
).
then
(()
=>
{
ipfs
.
unpin
(
hash
)
);
}).
then
(()
=>
{
logging
.
info
(
`Successfully deleted
${
list
.
length
}
attachments`
);
logging
.
info
(
`Successfully deleted
${
list
.
length
}
attachments`
);
});
});
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment