laat / mvn-dl

Download maven artifacts
12 stars 11 forks source link

[sugestion] custom retry and timeout #18

Closed sarahBuisson closed 4 years ago

sarahBuisson commented 4 years ago

hello, I use mvn-artifact-download in one of my lib

the maven registry that I use is a pain, with often error ( but is free). Is there anyway to configure a custom timeout value , or to automate a retry?

laat commented 4 years ago

I'm not sure it belongs here. It might, but the retry logic could be very application dependant. (exponential backoff, retry from a different repository, ...)

A basic retry could be done by wrapping the calls with https://github.com/sindresorhus/p-retry

laat commented 4 years ago

An optional timeout parameter is a good idea though.

sarahBuisson commented 4 years ago

at least the optional timeout would help me a lot. It's not something that I can do in the using code

laat commented 4 years ago

node-fetch has a timeout parameter, we need to add it to these lines:

https://github.com/laat/mvn-dl/blob/a49d1fc36f98ab767d75ba5e1f981bab0dfc9062/packages/mvn-artifact-url/src/artifact-url.ts#L30

https://github.com/laat/mvn-dl/blob/a49d1fc36f98ab767d75ba5e1f981bab0dfc9062/packages/mvn-artifact-download/src/artifact-download.ts#L38

laat commented 4 years ago

I'll add it tonight :)

laat commented 4 years ago

Released in version 5