File tree Expand file tree Collapse file tree
packages/artifact/src/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export function getUploadFileConcurrency(): number {
66// When uploading large files that can't be uploaded with a single http call, this controls
77// the chunk size that is used during upload
88export function getUploadChunkSize ( ) : number {
9- return 4 * 1024 * 1024 // 4 MB Chunks
9+ return 8 * 1024 * 1024 // 8 MB Chunks
1010}
1111
1212// The maximum number of retries that can be attempted before an upload or download fails
Original file line number Diff line number Diff line change @@ -27,7 +27,10 @@ export class DownloadHttpClient {
2727 private statusReporter : StatusReporter
2828
2929 constructor ( ) {
30- this . downloadHttpManager = new HttpManager ( getDownloadFileConcurrency ( ) )
30+ this . downloadHttpManager = new HttpManager (
31+ getDownloadFileConcurrency ( ) ,
32+ '@actions/artifact-download'
33+ )
3134 // downloads are usually significantly faster than uploads so display status information every second
3235 this . statusReporter = new StatusReporter ( 1000 )
3336 }
Original file line number Diff line number Diff line change @@ -6,12 +6,14 @@ import {createHttpClient} from './utils'
66 */
77export class HttpManager {
88 private clients : HttpClient [ ]
9+ private userAgent : string
910
10- constructor ( clientCount : number ) {
11+ constructor ( clientCount : number , userAgent : string ) {
1112 if ( clientCount < 1 ) {
1213 throw new Error ( 'There must be at least one client' )
1314 }
14- this . clients = new Array ( clientCount ) . fill ( createHttpClient ( ) )
15+ this . userAgent = userAgent
16+ this . clients = new Array ( clientCount ) . fill ( createHttpClient ( userAgent ) )
1517 }
1618
1719 getClient ( index : number ) : HttpClient {
@@ -22,7 +24,7 @@ export class HttpManager {
2224 // for more information see: https://github.com/actions/http-client/blob/04e5ad73cd3fd1f5610a32116b0759eddf6570d2/index.ts#L292
2325 disposeAndReplaceClient ( index : number ) : void {
2426 this . clients [ index ] . dispose ( )
25- this . clients [ index ] = createHttpClient ( )
27+ this . clients [ index ] = createHttpClient ( this . userAgent )
2628 }
2729
2830 disposeAndReplaceAllClients ( ) : void {
Original file line number Diff line number Diff line change @@ -42,7 +42,10 @@ export class UploadHttpClient {
4242 private statusReporter : StatusReporter
4343
4444 constructor ( ) {
45- this . uploadHttpManager = new HttpManager ( getUploadFileConcurrency ( ) )
45+ this . uploadHttpManager = new HttpManager (
46+ getUploadFileConcurrency ( ) ,
47+ '@actions/artifact-upload'
48+ )
4649 this . statusReporter = new StatusReporter ( 10000 )
4750 }
4851
Original file line number Diff line number Diff line change @@ -204,8 +204,8 @@ export function getUploadHeaders(
204204 return requestOptions
205205}
206206
207- export function createHttpClient ( ) : HttpClient {
208- return new HttpClient ( 'actions/artifact' , [
207+ export function createHttpClient ( userAgent : string ) : HttpClient {
208+ return new HttpClient ( userAgent , [
209209 new BearerCredentialHandler ( getRuntimeToken ( ) )
210210 ] )
211211}
You can’t perform that action at this time.
0 commit comments