mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-23 07:42:10 +00:00
improve fetch pattern
This commit is contained in:
parent
0ea2c2a233
commit
6fd81d0bb2
@ -2,4 +2,6 @@ CLUSTER_KEY=f414c23b4cdf4e84a6a66ecfd528eff2
|
||||
PROBE_NAME=US
|
||||
PROBE_KEY=33b674ca-9fdd-11e9-a2a3-2a2ae2dbccez
|
||||
SERVER_URL=http://localhost:3002
|
||||
DATA_INGESTOR_URL=http://localhost:3200
|
||||
DATA_INGESTOR_URL=http://localhost:3200
|
||||
RESOURCES_LIMIT=10
|
||||
FETCH_RESOURCES_URL=http://localhost:3400
|
@ -41,12 +41,12 @@ const _this = {
|
||||
});
|
||||
},
|
||||
|
||||
getApi: url => {
|
||||
getApi: (url, limit = 10) => {
|
||||
const headers = _this.getHeaders();
|
||||
return new Promise((resolve, reject) => {
|
||||
axios({
|
||||
method: 'GET',
|
||||
url: `${config.dataIngestorUrl}/${url}`,
|
||||
url: `${config.fetchResourcesUrl}/${url}?limit=${limit}`,
|
||||
headers,
|
||||
})
|
||||
.then(function(response) {
|
||||
|
@ -44,4 +44,5 @@ module.exports = {
|
||||
clusterKey: process.env['CLUSTER_KEY'],
|
||||
probeVersion: packageJson.version,
|
||||
dataIngestorUrl: process.env['DATA_INGESTOR_URL'],
|
||||
fetchResourcesUrl: process.env['FETCH_RESOURCES_URL'],
|
||||
};
|
||||
|
@ -11,6 +11,7 @@ const ServerMonitors = require('./serverMonitors');
|
||||
const ErrorService = require('../utils/errorService');
|
||||
const IncomingHttpRequestMonitors = require('./incomingHttpRequestMonitors');
|
||||
const KubernetesMonitors = require('./kubernetesMonitors');
|
||||
const limit = process.env.RESOURCES_LIMIT;
|
||||
// const ApiService = require('../utils/apiService');
|
||||
|
||||
/**
|
||||
@ -28,7 +29,7 @@ const KubernetesMonitors = require('./kubernetesMonitors');
|
||||
module.exports = {
|
||||
runJob: async function(monitorStore) {
|
||||
try {
|
||||
let monitors = await getApi('probe/monitors');
|
||||
let monitors = await getApi('probe/monitors', limit);
|
||||
monitors = JSON.parse(monitors.data); // parse the stringified data
|
||||
|
||||
// add monitor to store
|
||||
|
Loading…
Reference in New Issue
Block a user