mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00
(scrape-feeds-actor) Add explicit commit in case it's disabled
This commit is contained in:
parent
542690d9f6
commit
b2de3c70fa
@ -14,6 +14,8 @@ import nu.marginalia.service.control.ServiceEventLog;
|
|||||||
import nu.marginalia.service.module.ServiceConfiguration;
|
import nu.marginalia.service.module.ServiceConfiguration;
|
||||||
import org.jsoup.Jsoup;
|
import org.jsoup.Jsoup;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
@ -31,6 +33,8 @@ import java.util.Optional;
|
|||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ScrapeFeedsActor extends RecordActorPrototype {
|
public class ScrapeFeedsActor extends RecordActorPrototype {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ScrapeFeedsActor.class);
|
||||||
|
|
||||||
private final Duration pollInterval = Duration.ofHours(6);
|
private final Duration pollInterval = Duration.ofHours(6);
|
||||||
|
|
||||||
private final ServiceEventLog eventLog;
|
private final ServiceEventLog eventLog;
|
||||||
@ -148,12 +152,18 @@ public class ScrapeFeedsActor extends RecordActorPrototype {
|
|||||||
"""))
|
"""))
|
||||||
{
|
{
|
||||||
for (var domain : domains) {
|
for (var domain : domains) {
|
||||||
|
logger.info("Inserting domain {} into the database", domain);
|
||||||
|
|
||||||
stmt.setString(1, domain.toString());
|
stmt.setString(1, domain.toString());
|
||||||
stmt.setString(2, domain.getTopDomain());
|
stmt.setString(2, domain.getTopDomain());
|
||||||
stmt.setInt(3, node);
|
stmt.setInt(3, node);
|
||||||
stmt.addBatch();
|
stmt.addBatch();
|
||||||
}
|
}
|
||||||
stmt.executeBatch();
|
stmt.executeBatch();
|
||||||
|
|
||||||
|
if (!conn.getAutoCommit()) {
|
||||||
|
conn.commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user