Re: [PATCH] ruby: make sure the database is closed
authorFelipe Contreras <felipe.contreras@gmail.com>
Mon, 23 Apr 2012 15:07:23 +0000 (18:07 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:40 +0000 (09:46 -0800)
55/3b687f90e525f2862bed689e401023b91ff35f [new file with mode: 0644]

diff --git a/55/3b687f90e525f2862bed689e401023b91ff35f b/55/3b687f90e525f2862bed689e401023b91ff35f
new file mode 100644 (file)
index 0000000..6be2599
--- /dev/null
@@ -0,0 +1,93 @@
+Return-Path: <felipe.contreras@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 175C2431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 08:07:27 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id TxsVU5sNw1PQ for <notmuch@notmuchmail.org>;\r
+       Mon, 23 Apr 2012 08:07:26 -0700 (PDT)\r
+Received: from mail-ey0-f181.google.com (mail-ey0-f181.google.com\r
+       [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2C311431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 08:07:26 -0700 (PDT)\r
+Received: by eaa1 with SMTP id 1so4912810eaa.26\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 08:07:23 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
+       :cc:content-type;\r
+       bh=WA3Wqp46pcCqFw/5HuNJJKjQIw5GOpMJ9NtnEc9d+ck=;\r
+       b=S0RRDY0ZLyP6XOm/++aliPpMw/9ZhIgY5ppBjxgz97dwbJInbxjaLGCROPCmXHMHiq\r
+       ChL8l+VLKMnqgIEuDbwNTfgTJ9sGac+pJ0RjWMdSlzqB4n4/QgZ1ZHalvdBk/0REFq/r\r
+       LSjGOEUqKy/ruSTZQ3Ore2bGO8DJC09d5qe0wniw0NjHXW+FRUIWvnXx4cpIc8vfOn+U\r
+       5suq62KLrFwhWKDM6W3IJp4HbfzFZnQsfabJkQfAy816PnjynbIwJDbbgVnSxfq66Hlg\r
+       4OQGrjXrr21hbWtmvk1NVPcP92YbsvK4NNvhVzih+7r/kQg7E3DLIF9F6IsTTahWgLUu\r
+       p2Dw==\r
+MIME-Version: 1.0\r
+Received: by 10.213.16.140 with SMTP id o12mr1239676eba.150.1335193643295;\r
+       Mon, 23 Apr 2012 08:07:23 -0700 (PDT)\r
+Received: by 10.213.103.18 with HTTP; Mon, 23 Apr 2012 08:07:23 -0700 (PDT)\r
+In-Reply-To:\r
+ <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>\r
+References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com>\r
+       <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>\r
+Date: Mon, 23 Apr 2012 18:07:23 +0300\r
+Message-ID:\r
+ <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>\r
+Subject: Re: [PATCH] ruby: make sure the database is closed\r
+From: Felipe Contreras <felipe.contreras@gmail.com>\r
+To: Ali Polatel <alip@exherbo.org>\r
+Content-Type: text/plain; charset=UTF-8\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 23 Apr 2012 15:07:27 -0000\r
+\r
+On Mon, Apr 23, 2012 at 5:04 PM, Ali Polatel <alip@exherbo.org> wrote:\r
+\r
+> I'd rather not do this.\r
+> Please read: http://comments.gmane.org/gmane.comp.lang.ruby.general/320324\r
+\r
+OK, I've read this.. So?\r
+\r
+The order in which Ruby's garbage-collector frees the database and\r
+other objects is irrelevant, because with this patch we are not\r
+manually freeing other objects, only the database.\r
+\r
+Sure, it's _better_ if the user calls close(), even better if it's\r
+inside an 'ensure', and even better if blocks are used (which I am\r
+using in most cases), but that's not *required*.\r
+\r
+The user might just do:\r
+\r
+def foo\r
+  db = Notmuch::Database.new($db_name, :mode => Notmuch::MODE_READ_WRITE)\r
+end\r
+\r
+That's perfectly fine in Ruby (although not ideal), since 'db' will\r
+get garbage-collected. But nobody will be able to use the database\r
+again until that process is killed.\r
+\r
+You think that's correct?\r
+\r
+-- \r
+Felipe Contreras\r