summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordemo <demo@antix1>2026-05-30 23:55:14 -0400
committerdemo <demo@antix1>2026-05-30 23:58:19 -0400
commit94093807a03d295f82bcec82244f68fb10efe312 (patch)
tree3fa4b78c3f6bf4c2a65bde6e6df9d13e041ad95c
parent1ad61d7da649dbe6603c819a20e2f705a2935bdc (diff)
feat: add code to handle maxDepth
-rw-r--r--workers.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/workers.go b/workers.go
index c162954..02d7d7d 100644
--- a/workers.go
+++ b/workers.go
@@ -76,6 +76,14 @@ loop:
break loop
}
+ // This works similarly to the classic
+ // example: if we're at the max depth,
+ // don't tell any of the workers to
+ // fetch new URLs.
+ if maxDepth > 0 && p.depth == maxDepth {
+ continue
+ }
+
packets <- p
}
}