Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 8AAF4431FC0 for ; Tue, 29 Jan 2013 15:26:26 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RK882ojw7mzX for ; Tue, 29 Jan 2013 15:26:23 -0800 (PST) Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 2431F431FAE for ; Tue, 29 Jan 2013 15:26:23 -0800 (PST) Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net ([156.34.82.78] helo=zancas.localnet) by tesseract.cs.unb.ca with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1U0KZK-0004lK-4Y; Tue, 29 Jan 2013 19:26:22 -0400 Received: from bremner by zancas.localnet with local (Exim 4.80) (envelope-from ) id 1U0KZE-0007G8-JE; Tue, 29 Jan 2013 19:26:16 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Subject: [PATCH 1/2] test: delay watchdog checks in emacs. Date: Tue, 29 Jan 2013 19:26:12 -0400 Message-Id: <1359501973-27671-2-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359501973-27671-1-git-send-email-david@tethera.net> References: <1359501973-27671-1-git-send-email-david@tethera.net> X-Spam_bar: - Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2013 23:26:26 -0000 From: David Bremner Instead of checking immediately for the watched process, delay a minute, or in the case that process-attributes returns nil, for two minutes. This is intended to cope with the case that process-attributes is unimplimented, and returns always returns nil. In this case, the watchdog check is the same as the two minute limit imposed by timeout. --- test/test-lib.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/test-lib.el b/test/test-lib.el index dece811..d26b49f 100644 --- a/test/test-lib.el +++ b/test/test-lib.el @@ -77,12 +77,19 @@ invisible text." (setq start next-pos))) str)) -(defun orphan-watchdog (pid) +(defun orphan-watchdog-check (pid) "Periodically check that the process with id PID is still running, quit if it terminated." (if (not (process-attributes pid)) - (kill-emacs) - (run-at-time "1 min" nil 'orphan-watchdog pid))) + (kill-emacs))) + +(defun orphan-watchdog (pid) + "Initiate orphan watchdog check." + ; If process-attributes returns nil right away, that probably means + ; it is unimplimented. So we delay two minutes before killing emacs. + (if (process-attributes pid) + (run-at-time 60 60 'orphan-watchdog-check pid) + (run-at-time 120 60 'orphan-watchdog-check pid))) (defun hook-counter (hook) "Count how many times a hook is called. Increments -- 1.7.10.4