Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xpub-epmc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Literature-services
public-projects
xpub-epmc
Commits
90f1ec87
Commit
90f1ec87
authored
3 years ago
by
Yogmatee Roochun
Browse files
Options
Downloads
Patches
Plain Diff
gitlab-1179
parent
6961cfe5
No related branches found
No related tags found
3 merge requests
!380
Pipeline changes
,
!379
Build step added for the master branch
,
!378
k8s release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/ftp-integration/fromFTP-BulkUpload.js
+10
-13
10 additions, 13 deletions
server/ftp-integration/fromFTP-BulkUpload.js
with
10 additions
and
13 deletions
server/ftp-integration/fromFTP-BulkUpload.js
+
10
−
13
View file @
90f1ec87
...
...
@@ -68,6 +68,7 @@ queue.drain(() => {
queue
.
error
((
err
,
task
)
=>
{
logger
.
error
(
`Error in task
${
task
}
:
${
err
}
`
)
process
.
exit
(
1
)
})
function
close
(
ftp
)
{
...
...
@@ -109,9 +110,12 @@ async function checkNewFtpPackage(ftp, ftpBulkUploader, rootPathLocal) {
if
(
!
targzFiles
.
length
)
{
resolve
(
0
)
// No files to download to local FTP space
}
downloadFtpFiles
(
targzFiles
,
ftp
,
rootPathFTP
,
rootPathLocal
).
then
(()
=>
resolve
(
targzFiles
.
length
),
)
downloadFtpFiles
(
targzFiles
,
ftp
,
rootPathFTP
,
rootPathLocal
)
.
then
(()
=>
resolve
(
targzFiles
.
length
))
.
catch
(
err
=>
{
logger
.
error
(
err
.
message
)
reject
(
err
.
message
)
})
})
})
ftp
.
on
(
'
error
'
,
()
=>
...
...
@@ -125,27 +129,20 @@ async function checkNewFtpPackage(ftp, ftpBulkUploader, rootPathLocal) {
}
function
downloadFtpFiles
(
targzFiles
,
ftp
,
rootPathFTP
,
rootPathLocal
)
{
let
counter
=
0
return
Promise
.
all
(
targzFiles
.
map
(
(
file
,
index
,
array
)
=>
file
=>
new
Promise
((
resolve
,
reject
)
=>
{
const
remoteFilePath
=
`
${
rootPathFTP
}
/
${
file
.
name
}
`
ftp
.
get
(
remoteFilePath
,
(
err
,
stream
)
=>
{
if
(
err
)
{
logger
.
error
(
remoteFilePath
)
logger
.
error
(
err
.
message
)
counter
+=
1
if
(
counter
===
array
.
length
)
{
reject
(
err
.
message
)
}
reject
(
err
.
message
)
}
else
if
(
!
stream
)
{
logger
.
error
(
remoteFilePath
)
logger
.
error
(
`No FTP get stream`
)
counter
+=
1
if
(
counter
===
array
.
length
)
{
reject
(
err
.
message
)
}
reject
(
err
.
message
)
}
else
{
const
path
=
`
${
rootPathLocal
}
/
${
file
.
name
}
`
const
writeStream
=
stream
.
pipe
(
fs
.
createWriteStream
(
path
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment