Re: [PATCH] ruby: make sure the database is closed
authorAli Polatel <alip@exherbo.org>
Mon, 23 Apr 2012 20:43:04 +0000 (23:43 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:40 +0000 (09:46 -0800)
58/ec0b273e7517cd1f9fb5fdc3c8c2d2f48a7e19 [new file with mode: 0644]

diff --git a/58/ec0b273e7517cd1f9fb5fdc3c8c2d2f48a7e19 b/58/ec0b273e7517cd1f9fb5fdc3c8c2d2f48a7e19
new file mode 100644 (file)
index 0000000..57ddf06
--- /dev/null
@@ -0,0 +1,118 @@
+Return-Path: <polatel@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 1B939431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 13:43:07 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
+       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 pVV4mfUsWxX5 for <notmuch@notmuchmail.org>;\r
+       Mon, 23 Apr 2012 13:43:06 -0700 (PDT)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id CD5E3431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 13:43:05 -0700 (PDT)\r
+Received: by bkcjm2 with SMTP id jm2so2465624bkc.26\r
+       for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 13:43:04 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:cc:content-type\r
+       :content-transfer-encoding;\r
+       bh=TKowrrC6ONX0UtotMe9lRoO+LGE8mGy1L5JaM51UUXs=;\r
+       b=ZkOxioEU3cAAMOZZnEepdyWJHay0fYesbj+2rlMpkoTjcy014fI+biOooPrSQPg+3z\r
+       6mqoJQI9//EuMoOXs2YvxpWLnzRrEnL3bTesTttcqEeoR0vQ/N8SlcS404L6sHz+8Plu\r
+       NCxc6s2s6QCUmU6zqL4goX+Q2Tq4K7d5emsvZhqWJfOQJ/7KQLsF8sue7IA2oqQ0uJ+3\r
+       5zquJKeouope2sMld/F4iA2bt1/nUwhd1+TEnks1OW+997mqlpyuyvXIzzNEVN7bRbw4\r
+       tnLhnWrONnAcDGNkADux6cBu+ldp1nyNlvJbJ2tlfrfv4KIz7oG61FfXK5HQI6Y/oYeC\r
+       VFNw==\r
+MIME-Version: 1.0\r
+Received: by 10.204.152.209 with SMTP id h17mr2884104bkw.111.1335213784219;\r
+       Mon, 23 Apr 2012 13:43:04 -0700 (PDT)\r
+Sender: polatel@gmail.com\r
+Received: by 10.204.123.73 with HTTP; Mon, 23 Apr 2012 13:43:04 -0700 (PDT)\r
+In-Reply-To:\r
+ <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>\r
+References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com>\r
+       <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>\r
+       <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>\r
+Date: Mon, 23 Apr 2012 23:43:04 +0300\r
+X-Google-Sender-Auth: G2yLOadNJ0F1xHWZwlD2SFYppnU\r
+Message-ID:\r
+ <CADv3eywb0tguYowTAK5Ag9YZ48zFZA0QJVNEj_cZcCpr-76Bbg@mail.gmail.com>\r
+Subject: Re: [PATCH] ruby: make sure the database is closed\r
+From: Ali Polatel <alip@exherbo.org>\r
+To: Felipe Contreras <felipe.contreras@gmail.com>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\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 20:43:07 -0000\r
+\r
+2012/4/23 Felipe Contreras <felipe.contreras@gmail.com>:\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/3203=\r
+24\r
+>\r
+> OK, I've read this.. So?\r
+\r
+You are one step close to what I thought you had thought.\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
+What I wanted was to make all objects "depending" on the database to be unu=\r
+sable\r
+once the database object is freed. Seeing that's not practically easy\r
+I decided to leave\r
+it to the user.\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
+If you have such a use case, I'm fine with that patch.\r
+I might push it in the next few days or get someone else to push it.\r
+\r
+> The user might just do:\r
+>\r
+> def foo\r
+> =A0db =3D Notmuch::Database.new($db_name, :mode =3D> Notmuch::MODE_READ_W=\r
+RITE)\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
+Yes that is correct. I have not thought about this.\r
+I'd say it's a partial misunderstanding on my part due to lack of\r
+(and/or too much) vodka.\r
+\r
+> --\r
+> Felipe Contreras\r
+\r
+        -alip\r