From 1e579064aed9f32061e5edbe1c693cab21f0ce75 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 6 May 2015 15:30:06 -0400 Subject: dmd: Improve offlineimap service. This change, coupled with not using the "autorefresh" mode, means that OfflineIMAP doesn't eat all of my RAM anymore! --- dotfiles/dmd.d/init.scm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/dotfiles/dmd.d/init.scm b/dotfiles/dmd.d/init.scm index ff91b05..420c7cf 100644 --- a/dotfiles/dmd.d/init.scm +++ b/dotfiles/dmd.d/init.scm @@ -1,3 +1,13 @@ +(use-modules (ice-9 match)) + +(define-syntax-rule (forever body ...) + (while #t body ...)) + +(define-syntax-rule (with-fork body ...) + (match (primitive-fork) + (0 (begin body ...)) + (pid pid))) + (define (simple-service program) (make #:provides (list (string->symbol program)) @@ -6,7 +16,18 @@ #:stop (make-kill-destructor))) (register-services - (simple-service "offlineimap") + (make + #:provides '(offlineimap) + #:requires '() + #:start (lambda args + (with-fork + ;; OfflineIMAP's "autorefresh" mode consistently + ;; consumes all of the RAM on my machine, so let's just + ;; run it in a loop instead. + (forever + (system* "offlineimap") + (sleep 20)))) + #:stop (make-kill-destructor)) (simple-service "mpd") (simple-service "mpdscribble")) -- cgit v1.2.3