M11: the planner accepts reserved test names for seeds on a test network, as the crawler does for peers
Found by the pasture's crawler scenario: a mastodon.test seed was dropped before it was ever planned. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ELjqpznMFMNrJoJUj6K5p2
This commit is contained in:
1 parent
4f5df743ae
commit
d0a13d9cc2
1 file changed
+4
-2
@@ -28,12 +28,14 @@ namespace PrivaPub.Federation.Crawler
|
||||
readonly IJobQueue _queue;
|
||||
readonly IDomainBlocks _blocks;
|
||||
readonly IOptionsMonitor<StatisticsOptions> _options;
|
||||
readonly IOptionsMonitor<FederationOptions> _federation;
|
||||
|
||||
public CrawlPlanner(IJobQueue queue, IDomainBlocks blocks, IOptionsMonitor<StatisticsOptions> options)
|
||||
public CrawlPlanner(IJobQueue queue, IDomainBlocks blocks, IOptionsMonitor<StatisticsOptions> options, IOptionsMonitor<FederationOptions> federation = default)
|
||||
{
|
||||
_queue = queue;
|
||||
_blocks = blocks;
|
||||
_options = options;
|
||||
_federation = federation;
|
||||
}
|
||||
|
||||
public JobKind Kind => JobKind.CrawlPlan;
|
||||
@@ -55,7 +57,7 @@ namespace PrivaPub.Federation.Crawler
|
||||
if (!crawler.Enabled)
|
||||
return JobOutcome.Done;
|
||||
var now = DateTime.UtcNow;
|
||||
foreach (var seed in PeerHosts.Filter(crawler.Seeds ?? new(), host => !_blocks.IsSuspended(host)))
|
||||
foreach (var seed in PeerHosts.Filter(crawler.Seeds ?? new(), host => !_blocks.IsSuspended(host), _federation?.CurrentValue.AllowPrivateNetworks == true))
|
||||
await DB.Default.Update<RemoteInstance>()
|
||||
.Match(i => i.Host == seed)
|
||||
.Modify(b => b.SetOnInsert(i => i.Seen, "crawled"))
|
||||
|
||||
Reference in new issue
Block a user