Added more loggers to http module.
This commit is contained in:
parent
9040285ce5
commit
0e4fd12d70
|
@ -10,7 +10,10 @@
|
|||
:content="$refs.content"
|
||||
/>
|
||||
|
||||
<Releases :releases="releases" />
|
||||
<Releases
|
||||
:releases="releases"
|
||||
:done="done"
|
||||
/>
|
||||
|
||||
<Pagination
|
||||
v-if="totalCount > 0"
|
||||
|
@ -30,6 +33,8 @@ import Releases from '../releases/releases.vue';
|
|||
import Pagination from '../pagination/pagination.vue';
|
||||
|
||||
async function fetchReleases(scroll = true) {
|
||||
this.done = false;
|
||||
|
||||
const { releases, totalCount } = await this.$store.dispatch('fetchReleases', {
|
||||
limit: this.limit,
|
||||
range: this.$route.params.range,
|
||||
|
@ -38,6 +43,7 @@ async function fetchReleases(scroll = true) {
|
|||
|
||||
this.totalCount = totalCount;
|
||||
this.releases = releases;
|
||||
this.done = true;
|
||||
|
||||
if (scroll) {
|
||||
this.$refs.filter?.$el.scrollIntoView();
|
||||
|
@ -64,6 +70,7 @@ export default {
|
|||
limit: 30,
|
||||
totalCount: 0,
|
||||
from: null,
|
||||
done: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -306,6 +306,12 @@ const { argv } = yargs
|
|||
type: 'array',
|
||||
alias: ['delete-movie', 'remove-movies', 'remove-movies'],
|
||||
})
|
||||
.option('request-timeout', {
|
||||
describe: 'Default timeout after which to cancel a HTTP request.',
|
||||
type: 'number',
|
||||
alias: ['timeout'],
|
||||
default: 60000,
|
||||
})
|
||||
.coerce('after', interpretAfter)
|
||||
.coerce('actors-update', interpretAfter);
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ Promise.config({
|
|||
});
|
||||
|
||||
const defaultOptions = {
|
||||
timeout: 60000,
|
||||
timeout: argv.requestTimeout,
|
||||
encodeJSON: true,
|
||||
headers: {
|
||||
'user-agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1',
|
||||
|
@ -77,6 +77,8 @@ function getLimiter(options = {}, url) {
|
|||
});
|
||||
}
|
||||
|
||||
limiters[interval][concurrency].on('queued', () => logger.silly(`Queued ${url}`));
|
||||
|
||||
return limiters[interval][concurrency];
|
||||
}
|
||||
|
||||
|
@ -136,6 +138,7 @@ async function finalizeResult(res, options) {
|
|||
function getTimeout(options, url) {
|
||||
return new Promise((resolve, reject, onCancel) => {
|
||||
const timeout = setTimeout(() => {
|
||||
logger.debug(`Canceled timed out request to ${url}`);
|
||||
reject(new Error(`URL ${url} timed out`));
|
||||
}, (options?.timeout || defaultOptions.timeout) + 10000);
|
||||
|
||||
|
@ -166,6 +169,8 @@ async function scheduleRequest(method = 'get', url, body, requestOptions = {}) {
|
|||
|
||||
const curatedResult = await finalizeResult(result, options);
|
||||
|
||||
logger.silly(`Response ${curatedResult.status} for ${method.toUpperCase()} ${url}`);
|
||||
|
||||
return curatedResult;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue