summaryrefslogtreecommitdiff
path: root/scripts/mumi.in
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2020-04-07 15:56:13 +0200
committerRicardo Wurmus <rekado@elephly.net>2020-04-07 15:56:13 +0200
commit5c21d1deb3e534aedaaae4802423db0a5df041b0 (patch)
treec31d7979cfb00ecf008d4382d034085c3d3c4070 /scripts/mumi.in
parentab53797fbd5ecb3c076cc7bdfdbb284840abc15f (diff)
scripts: update-state!: Do a full refresh every 100 times.
Diffstat (limited to 'scripts/mumi.in')
-rw-r--r--scripts/mumi.in48
1 files changed, 29 insertions, 19 deletions
diff --git a/scripts/mumi.in b/scripts/mumi.in
index 5a91424..a60cf15 100644
--- a/scripts/mumi.in
+++ b/scripts/mumi.in
@@ -56,25 +56,35 @@
"Failed to index `~a'~%" (%config 'mail-dir)))))))
(define update-state!
- (lambda _
- (catch #t
- (lambda ()
- (let ((nums (sort (append-map (lambda (package)
- (soap-invoke* (%config 'debbugs)
- get-bugs
- `((package . ,package))))
- (%config 'packages)) >)))
- (update-mboxes! nums)
- (mu-index)
- (update-bug-database! nums))
- (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!)))))
+ (let ((count 0))
+ (lambda _
+ (catch #t
+ (lambda ()
+ (when (zero? count)
+ (format (current-error-port) "Full refresh!~%"))
+ (let ((nums (sort
+ (append-map (lambda (package)
+ (soap-invoke*
+ (%config 'debbugs)
+ get-bugs
+ `((package . ,package)
+ (archive . ,(if (zero? count)
+ 'both
+ 0)))))
+ (%config 'packages)) >)))
+ (update-mboxes! nums)
+ (mu-index)
+ (update-bug-database! nums)
+ (set! count (modulo (1+ count) 100)))
+ (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)
+ (set! count (modulo (1+ count) 100))
+ (sleep %update-interval)
+ (update-state!))))))
(define %options
;; Specifications of the command-line options