cleanup/enhance cleanup
This commit is contained in:
+27
-3
@@ -52,19 +52,31 @@ const countedQuorumFailures = new Set(); // Set of domain names that have been c
|
||||
const countedTies = new Set(); // Set of tie keys: "domain:claimant"
|
||||
|
||||
async function getAllEntries(pass = state.dnsPass, useCache = true) {
|
||||
// Skip operations during shutdown to prevent corestore access errors
|
||||
if (state.isShuttingDown) {
|
||||
logDebug('Core', 'Skipping getAllEntries during shutdown');
|
||||
return entriesCache || []; // Return cached entries if available, otherwise empty array
|
||||
}
|
||||
|
||||
const now = Date.now();
|
||||
|
||||
|
||||
// Return cached entries if still valid
|
||||
if (useCache && entriesCache && (now - entriesCacheTimestamp) < CACHE_TTL_MS) {
|
||||
logDebug('Core', 'Returning cached entries');
|
||||
return entriesCache;
|
||||
}
|
||||
|
||||
|
||||
// Check if pass is null
|
||||
if (!pass) {
|
||||
logDebug('Core', 'dnsPass not initialized, returning empty entries');
|
||||
return [];
|
||||
}
|
||||
|
||||
// Check if pass is closed
|
||||
if (pass.closed) {
|
||||
logDebug('Core', 'dnsPass is closed, returning cached entries');
|
||||
return entriesCache || [];
|
||||
}
|
||||
|
||||
const entries = [];
|
||||
try {
|
||||
@@ -559,9 +571,21 @@ async function getDomainSSLStatus(domain) {
|
||||
}
|
||||
|
||||
async function doAutoVotes() {
|
||||
// Skip operations during shutdown to prevent corestore access errors
|
||||
if (state.isShuttingDown) {
|
||||
logDebug('Core', 'Skipping doAutoVotes during shutdown');
|
||||
return;
|
||||
}
|
||||
|
||||
const pass = state.dnsPass;
|
||||
if (!pass) return;
|
||||
|
||||
|
||||
// Check if pass is closed
|
||||
if (pass.closed) {
|
||||
logDebug('Core', 'dnsPass is closed, skipping doAutoVotes');
|
||||
return;
|
||||
}
|
||||
|
||||
logInfo('Core', 'Performing auto-votes check');
|
||||
const allEntries = await getAllEntries();
|
||||
logDebug('Core', `All keys in auto-votes check: ${allEntries.map(e => e.key).join(', ')}`);
|
||||
|
||||
Reference in New Issue
Block a user