Skip to content

Commit

Permalink
Limit matched node result set to prevent unbounded memory use (requir…
Browse files Browse the repository at this point in the history
…es chicken-doc 0.4.4); bump to 0.10.1
  • Loading branch information
ursetto committed Jul 23, 2012
1 parent bdb9554 commit f09d347
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions chickadee-config-nginx.scm
Expand Up @@ -33,8 +33,8 @@
(cache-bust "chickadee-jquery.js")
(cache-bust "prettify-bundle.js")))

(maximum-match-results 250)
(maximum-match-signatures 100)
(maximum-match-results 150)
(maximum-match-signatures 150)
(incremental-search 15)
(incremental-search-delay 50)
(cache-nodes-for 600)
Expand Down
2 changes: 1 addition & 1 deletion chickadee-config.scm
Expand Up @@ -34,7 +34,7 @@
))

(maximum-match-results 250)
(maximum-match-signatures 100)
(maximum-match-signatures 250)
(incremental-search 15)
(incremental-search-delay 50)
(cache-nodes-for 300)
Expand Down
2 changes: 1 addition & 1 deletion chickadee.meta
Expand Up @@ -8,7 +8,7 @@
(doc-from-wiki)
(needs matchable uri-common intarweb
(spiffy 4.8) spiffy-request-vars
(chicken-doc 0.4.0)
(chicken-doc 0.4.4)
sxml-transforms uri-generic (chicken-doc-admin 0.4.0)
(chicken-doc-html 0.2.5))
(files "chickadee-cmd.scm" "chickadee-config.scm" "chickadee-driver-3e8.scm" "chickadee.setup" "chickadee.release-info" "jquery.metadata.min.js" "chickadee.meta" "mag.png" "chickadee.js" "chickadee.scm" "chickadee-config-nginx.scm" "install.sh" "chickadee-jquery.js" "chickadee.css" "chickadee-driver.scm"))
10 changes: 7 additions & 3 deletions chickadee.scm
Expand Up @@ -109,7 +109,7 @@
(value "Regexp"))))))

(define (format-id x)
(match (match-nodes x)
(match (match-nodes x (maximum-match-results))
((n1)
(redirect-to (path->href (node-path n1))))
(()
Expand All @@ -122,9 +122,11 @@
(match-page nodes x))))

(define (format-re x)
(match-page (match-nodes (irregex x)) x))
(match-page (match-nodes (irregex x) (maximum-match-results))
x))
(define (format-path-re x)
(match-page (match-node-paths/re (irregex x)) x))
(match-page (match-node-paths/re (irregex x) (maximum-match-results))
x))

(define (match-page nodes match-text)
(let ((max-results (maximum-match-results))
Expand All @@ -138,6 +140,8 @@
(lambda ()
(node-page
`("query " ,match-text " ("
;; Exceeding match-results can't happen because we cap the
;; result length now, but we keep the logic in place anyway
,(maybe (> result-length max-results)
`(,max-results " of "))
,result-length " matches)")
Expand Down
2 changes: 1 addition & 1 deletion chickadee.setup
@@ -1,6 +1,6 @@
;; -*- scheme -*-

(define +version+ "0.10.0")
(define +version+ "0.10.1")

(compile -s -O2 -d1 -S chickadee.scm -j chickadee)
(compile -s -O2 -d0 chickadee.import.scm)
Expand Down

0 comments on commit f09d347

Please sign in to comment.