Skip to content

Commit

Permalink
Reduce timeout to 10s + fix error handling (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x authored Jan 19, 2024
1 parent 8a8098b commit edae94c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions indexer/src/providers/providerStatusProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProviderSnapshot } from "@src/../../shared/dbSchemas/akash/providerSnap
import { toUTC } from "@src/shared/utils/date";

const ConcurrentStatusCall = 10;
const StatusCallTimeout = 30_000; // 30 seconds
const StatusCallTimeout = 10_000; // 10 seconds

export async function syncProvidersInfo() {
let providers = await Provider.findAll({
Expand Down Expand Up @@ -91,11 +91,13 @@ export async function syncProvidersInfo() {
});
} catch (err) {
const checkDate = new Date();
const errorMessage = err?.message?.toString() ?? err?.toString();

await Provider.update(
{
isOnline: false,
lastCheckDate: checkDate,
error: err?.message || err,
error: errorMessage,
akashVersion: null,
cosmosSdkVersion: null,
deploymentCount: null,
Expand All @@ -121,7 +123,7 @@ export async function syncProvidersInfo() {
await ProviderSnapshot.create({
owner: provider.owner,
isOnline: false,
error: err?.message || err,
error: errorMessage,
checkDate: checkDate
});
} finally {
Expand Down Expand Up @@ -170,4 +172,4 @@ function sumResources(resources) {
storage: 0
}
);
}
}

0 comments on commit edae94c

Please sign in to comment.