mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-10-05 21:22:39 +02:00
Compare commits
3 Commits
deploy-022
...
deploy-023
Author | SHA1 | Date | |
---|---|---|---|
|
ed62ec8a35 | ||
|
42b24cfa34 | ||
|
1ffaab2da6 |
@@ -27,10 +27,12 @@ public class DbBrowseDomainsRandom {
|
||||
public List<BrowseResult> getRandomDomains(int count, DomainBlacklist blacklist, int set) {
|
||||
|
||||
final String q = """
|
||||
SELECT DOMAIN_ID, DOMAIN_NAME, INDEXED
|
||||
SELECT EC_RANDOM_DOMAINS.DOMAIN_ID, DOMAIN_NAME, INDEXED
|
||||
FROM EC_RANDOM_DOMAINS
|
||||
INNER JOIN EC_DOMAIN ON EC_DOMAIN.ID=DOMAIN_ID
|
||||
LEFT JOIN DOMAIN_AVAILABILITY_INFORMATION DAI ON DAI.DOMAIN_ID=EC_RANDOM_DOMAINS.DOMAIN_ID
|
||||
WHERE STATE<2
|
||||
AND SERVER_AVAILABLE
|
||||
AND DOMAIN_SET=?
|
||||
AND DOMAIN_ALIAS IS NULL
|
||||
ORDER BY RAND()
|
||||
|
@@ -7,6 +7,7 @@ import nu.marginalia.ping.svc.HttpPingService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
@@ -85,6 +86,8 @@ public class PingJobScheduler {
|
||||
}
|
||||
|
||||
public void pause(int nodeId) {
|
||||
logger.info("Pausing PingJobScheduler for nodeId: {}", nodeId);
|
||||
|
||||
if (this.nodeId != null && this.nodeId != nodeId) {
|
||||
logger.warn("Attempted to pause PingJobScheduler with mismatched nodeId: expected {}, got {}", this.nodeId, nodeId);
|
||||
return;
|
||||
@@ -98,6 +101,7 @@ public class PingJobScheduler {
|
||||
}
|
||||
|
||||
public synchronized void resume(int nodeId) {
|
||||
logger.info("Resuming PingJobScheduler for nodeId: {}", nodeId);
|
||||
if (this.nodeId != null) {
|
||||
logger.warn("Attempted to resume PingJobScheduler with mismatched nodeId: expected {}, got {}", this.nodeId, nodeId);
|
||||
return;
|
||||
@@ -139,24 +143,14 @@ public class PingJobScheduler {
|
||||
|
||||
try {
|
||||
List<WritableModel> objects = switch (data) {
|
||||
case HistoricalAvailabilityData.JustDomainReference(DomainReference reference) -> {
|
||||
logger.info("Processing availability job for domain: {}", reference.domainName());
|
||||
yield httpPingService.pingDomain(reference, null, null);
|
||||
}
|
||||
case HistoricalAvailabilityData.JustAvailability(String domain, DomainAvailabilityRecord record) -> {
|
||||
logger.info("Availability check with no security info: {}", domain);
|
||||
yield httpPingService.pingDomain(
|
||||
new DomainReference(record.domainId(), record.nodeId(), domain),
|
||||
record,
|
||||
null);
|
||||
}
|
||||
case HistoricalAvailabilityData.AvailabilityAndSecurity(String domain, DomainAvailabilityRecord availability, DomainSecurityRecord security) -> {
|
||||
logger.info("Availability check with full historical data: {}", domain);
|
||||
yield httpPingService.pingDomain(
|
||||
new DomainReference(availability.domainId(), availability.nodeId(), domain),
|
||||
availability,
|
||||
security);
|
||||
}
|
||||
case HistoricalAvailabilityData.JustDomainReference(DomainReference reference)
|
||||
-> httpPingService.pingDomain(reference, null, null);
|
||||
case HistoricalAvailabilityData.JustAvailability(String domain, DomainAvailabilityRecord record)
|
||||
-> httpPingService.pingDomain(
|
||||
new DomainReference(record.domainId(), record.nodeId(), domain), record, null);
|
||||
case HistoricalAvailabilityData.AvailabilityAndSecurity(String domain, DomainAvailabilityRecord availability, DomainSecurityRecord security)
|
||||
-> httpPingService.pingDomain(
|
||||
new DomainReference(availability.domainId(), availability.nodeId(), domain), availability, security);
|
||||
};
|
||||
|
||||
pingDao.write(objects);
|
||||
@@ -201,8 +195,8 @@ public class PingJobScheduler {
|
||||
yield dnsPingService.pingDomain(oldRecord.rootDomainName(), oldRecord);
|
||||
}
|
||||
case RootDomainReference.ByName(String name) -> {
|
||||
var oldRecord = pingDao.getDomainDnsRecord(name);
|
||||
yield dnsPingService.pingDomain(oldRecord.rootDomainName(), oldRecord);
|
||||
@Nullable var oldRecord = pingDao.getDomainDnsRecord(name);
|
||||
yield dnsPingService.pingDomain(name, oldRecord);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -48,7 +48,6 @@ public class DnsPingService {
|
||||
switch (changes) {
|
||||
case DnsRecordChange.None _ -> {}
|
||||
case DnsRecordChange.Changed changed -> {
|
||||
logger.info("DNS record for {} changed: {}", newRecord.dnsRootDomainId(), changed);
|
||||
generatedRecords.add(DomainDnsEvent.builder()
|
||||
.rootDomainId(newRecord.dnsRootDomainId())
|
||||
.nodeId(newRecord.nodeAffinity())
|
||||
|
Reference in New Issue
Block a user