summaryrefslogtreecommitdiff
path: root/scripts/mumi.in
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-22 18:10:18 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-22 18:10:18 +0200
commit7cbc06bccfa89f83ff029b1487d2eed234a9c085 (patch)
tree2ab5288da8e0ae376cf26e012eb26239f859179a /scripts/mumi.in
parentf2b63f63aba2b210d2e556672c46fbca18556b76 (diff)
scripts: Do full index every 10 cycles.
Diffstat (limited to 'scripts/mumi.in')
-rw-r--r--scripts/mumi.in46
1 files changed, 26 insertions, 20 deletions
diff --git a/scripts/mumi.in b/scripts/mumi.in
index 02847e8..920b279 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -50,26 +50,32 @@
;; Keep indexing the mail directory
(define %update-interval 60)
-(define* (update-state! #:key loop?)
- (catch #t
- (lambda ()
- (index!)
- (let ((nums (sort (append-map (lambda (package)
- (soap-invoke* (%config 'debbugs)
- get-bugs
- `((package . ,package))))
- (%config 'packages)) >)))
- (update-bug-database! nums))
- (and loop?
- (begin
- (format (current-error-port)
- "Sleeping for ~a seconds." %update-interval)
- (sleep %update-interval)
- (update-state!))))
- (lambda args
- (format (current-error-port) "worker error: ~a~%" args)
- (sleep %update-interval)
- (update-state!))))
+(define update-state!
+ (let ((count -1))
+ (lambda* (#:key loop?)
+ (set! count (remainder (1+ count) 10))
+ (catch #t
+ (lambda ()
+ (when (zero? count)
+ (display "Starting full indexing." (current-error-port))
+ (newline (current-error-port)))
+ (index! #:full? (zero? count))
+ (let ((nums (sort (append-map (lambda (package)
+ (soap-invoke* (%config 'debbugs)
+ get-bugs
+ `((package . ,package))))
+ (%config 'packages)) >)))
+ (update-bug-database! nums))
+ (and loop?
+ (begin
+ (format (current-error-port)
+ "Sleeping for ~a seconds." %update-interval)
+ (sleep %update-interval)
+ (update-state!))))
+ (lambda args
+ (format (current-error-port) "worker error: ~a~%" args)
+ (sleep %update-interval)
+ (update-state!))))))
(define %options
;; Specifications of the command-line options