Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce timeout to 10s + fix error handling #81

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
);
}
}