mirror of
https://github.com/mempool/mempool.git
synced 2025-02-23 06:35:15 +01:00
Add audit replication success logging
This commit is contained in:
parent
e59a9d38ff
commit
1abd2a23cc
2 changed files with 3 additions and 2 deletions
|
@ -66,6 +66,7 @@ class AuditReplication {
|
||||||
if (syncResult) {
|
if (syncResult) {
|
||||||
if (syncResult.data?.template?.length) {
|
if (syncResult.data?.template?.length) {
|
||||||
await this.$saveAuditData(hash, syncResult.data);
|
await this.$saveAuditData(hash, syncResult.data);
|
||||||
|
logger.info(`Imported audit data from ${syncResult.server} for block ${syncResult.data.height} (${hash})`);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
if (!syncResult.data && !syncResult.exists) {
|
if (!syncResult.data && !syncResult.exists) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import axios, { AxiosResponse } from 'axios';
|
||||||
import { SocksProxyAgent } from 'socks-proxy-agent';
|
import { SocksProxyAgent } from 'socks-proxy-agent';
|
||||||
import * as https from 'https';
|
import * as https from 'https';
|
||||||
|
|
||||||
export async function $sync(path): Promise<{ data?: any, exists: boolean }> {
|
export async function $sync(path): Promise<{ data?: any, exists: boolean, server?: string }> {
|
||||||
// start with a random server so load is uniformly spread
|
// start with a random server so load is uniformly spread
|
||||||
let allMissing = true;
|
let allMissing = true;
|
||||||
const offset = Math.floor(Math.random() * config.REPLICATION.SERVERS.length);
|
const offset = Math.floor(Math.random() * config.REPLICATION.SERVERS.length);
|
||||||
|
@ -18,7 +18,7 @@ export async function $sync(path): Promise<{ data?: any, exists: boolean }> {
|
||||||
try {
|
try {
|
||||||
const result = await query(`https://${server}${path}`);
|
const result = await query(`https://${server}${path}`);
|
||||||
if (result) {
|
if (result) {
|
||||||
return { data: result, exists: true };
|
return { data: result, exists: true, server };
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
if (e?.response?.status === 404) {
|
if (e?.response?.status === 404) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue