Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
1735ad7f
Commit
1735ad7f
authored
5 years ago
by
Ajit Jagtap
Browse files
Options
Downloads
Plain Diff
Merge branch 'kunalt_downloadManager' into 'devbranch'
Timeout added in downloadhelper.mdl See merge request
!111
parents
75d44034
145d1cee
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!113
31 Aug MEP Merge Dev to Stg
,
!111
Timeout added in downloadhelper.mdl
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
downloadhelpermdl/downloadhelpermdl.go
+13
-1
downloadhelpermdl/downloadhelpermdl.go
with
13 additions
and
1 deletion
downloadhelpermdl/downloadhelpermdl.go
+
13
−
1
View file @
1735ad7f
...
...
@@ -52,6 +52,7 @@ type DownloadParameter struct {
jwtToken
string
isCacheBurst
bool
fileHashedValue
string
requestTimeOut
int64
DownloadError
error
}
...
...
@@ -82,6 +83,11 @@ func (dh *DownloadHelper) AddParamsCacheBurst(isCacheBurst bool) *DownloadHelper
return
dh
}
func
(
dh
*
DownloadHelper
)
AddRequestTimeout
(
requestTimeOutValue
int64
)
*
DownloadHelper
{
dh
.
DownloadParam
.
requestTimeOut
=
requestTimeOutValue
return
dh
}
// Run all Steps one by one
func
(
dh
*
DownloadHelper
)
Run
()
*
DownloadHelper
{
_
,
dh
.
DownloadParam
.
DownloadError
=
DownloadFile
(
dh
)
...
...
@@ -182,8 +188,14 @@ func downloadFileFromCloud(params *DownloadHelper) error {
defer
out
.
Close
()
//TODO: Code might be refactor (in case provision is given in httpmdl)
if
params
.
DownloadParam
.
requestTimeOut
<=
0
{
params
.
DownloadParam
.
requestTimeOut
=
0
}
// Fetching data from httpClient
client
:=
&
http
.
Client
{}
client
:=
&
http
.
Client
{
Timeout
:
time
.
Duration
(
params
.
DownloadParam
.
requestTimeOut
)
*
time
.
Second
,
}
// Call to fetch content
req
,
err
:=
http
.
NewRequest
(
"GET"
,
params
.
sourceURL
,
nil
)
...
...
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
Menu
Explore
Projects
Groups
Topics
Snippets