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