Add audit replication success logging

This commit is contained in:
Mononaut
2023-07-14 16:48:11 +09:00
parent e59a9d38ff
commit 1abd2a23cc
2 changed files with 3 additions and 2 deletions

View File

@@ -4,7 +4,7 @@ import axios, { AxiosResponse } from 'axios';
import { SocksProxyAgent } from 'socks-proxy-agent';
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
let allMissing = true;
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 {
const result = await query(`https://${server}${path}`);
if (result) {
return { data: result, exists: true };
return { data: result, exists: true, server };
}
} catch (e: any) {
if (e?.response?.status === 404) {