diff options
Diffstat (limited to 'src/utils.clj')
| -rwxr-xr-x | src/utils.clj | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/utils.clj b/src/utils.clj index 3f1a7b1..779bb7b 100755 --- a/src/utils.clj +++ b/src/utils.clj @@ -25,7 +25,7 @@ (.setDatabaseName db-name) (.setUser db-user) (.setPassword db-pass) - (.setMaxConnections 3))})) + (.setMaxConnections 20))})) ;; moved this to here which doesn't seem right... maybe a 'settings.clj' or something? (def *dumps-per-page* 20) @@ -98,6 +98,14 @@ [(int (/ (- f# s#) 1e6)) r#])) +(def truncation-factor 2) + +(defn insert-and-truncate! [list-ref item soft-limit] + (if (> (count @list-ref) (* soft-limit truncation-factor)) + (ref-set list-ref + (cons item (take soft-limit @list-ref))) + (ref-set list-ref (cons item @list-ref)))) + ;; Formatters (def yyyy-mm-dd-formatter (new SimpleDateFormat "yyyy-MM-dd")) |
