[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can this be improved

From: Cecil Westerhof
Subject: Can this be improved
Date: Mon, 15 Sep 2014 10:53:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

I have a few things I poll during idle time in Gnus.

At the moment I have the following structure:
           (list :idle          3
                 :function     'dcbl-gnus-delay-send-queue
                 :last-run     'dcbl-gnus-last-time-delay-send
                 :message      "send delayed messages"
                 :wait          5)
           (list :idle          5
                 :function     'dcbl-gnus-group-get-new-news
                 :last-run     'dcbl-gnus-last-time-got-news
                 :message      "getting new news"
                 :prefer-end   15
                 :prefer-start  5
                 :prefer-wait  30
                 :wait         60)
           (list :idle         15
                 :function     'dcbl-gnus-group-expire-all-groups
                 :last-run     'dcbl-gnus-last-time-expired-articles
                 :message      "expire"
                 :wait         (- (/ +seconds-in-day+ +seconds-in-minute+) 2))

At this moment I have three things I do: sending delayed messages,
getting new news and expiring articles.

Every polling structure needs at least:
- idle:     minutes idle before function is allowed to run
- function: function to run
- last-run: last time function was run
- message:  description used in logging
- wait:     minimum number of minutes between runs

Because I like the messages fetched shortly after the whole hour, I
have also:
- prefer-end:   end minute of preferred period
- prefer-start: start minute of preferred period
- prefer-wait:  minimum number of minutes that the function was not
  run in preferred period

Because with the current data structure it is no use to call the
daemon handler after a minute of idleness I set the Gnus idle daemon
    (gnus-demon-add-handler 'dcbl-gnus-idle-daemon
                            (let  ((value nil))
                              (apply 'min
                                     (dolist (poll-element 
dcbl-gnus-poll-struct value)
                                       (push (getf poll-element :wait) 

Is this the correct way to do this, or is there a better way?

By the way gnus-demon-add-handler is correct. Probably a spelling
mistake made long ago.

Cecil Westerhof
Senior Software Engineer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]