1 Return-Path: <felipe.contreras@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id DA4B1431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 15:45:27 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id 9EJoSm1zJ7WM for <notmuch@notmuchmail.org>;
\r
17 Mon, 23 Apr 2012 15:45:26 -0700 (PDT)
\r
18 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com
\r
19 [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 5B548431FAE for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 15:45:26 -0700
\r
23 Received: by eekb47 with SMTP id b47so17209eek.26
\r
24 for <notmuch@notmuchmail.org>; Mon, 23 Apr 2012 15:45:23 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
\r
27 :cc:content-type:content-transfer-encoding;
\r
28 bh=Mw+5107Em+k4IeaifxjICdR6z2LCM/P0wyPcYzcBQ54=;
\r
29 b=XojguKhbBk5PVo6u7YZJFqJf+baf6MzlMM+bgsgV5+43sQ0jak3iWYfDTX/XpehQBw
\r
30 YK8KQ8yooKWLn8eUD6n9Jj9ymjL6Kr0uE7cCtAoTP1AwQH8swff/OVCV4VXGeLU0coTI
\r
31 yiEyO7p7k3HDU7zqtphQB5+Z9EGM1Oo6TMlg7ya1NSuI91HFD1mKvxQpZidInv7uue/D
\r
32 ZS/Jfstfq4mc5A47mSiP8AZN5fTPfB94Kr+eRnlliQ77LhR0Qb+Dgb5mSuSOOa/1mgMt
\r
33 +HVeuOooMW9800ixIJQPXrkbD1sH2eNyoICJ+B1fncZsvFMFtIJKSfuNjNV3jaMdzpjW
\r
36 Received: by 10.213.9.209 with SMTP id m17mr1424450ebm.19.1335221123501; Mon,
\r
37 23 Apr 2012 15:45:23 -0700 (PDT)
\r
38 Received: by 10.213.103.18 with HTTP; Mon, 23 Apr 2012 15:45:23 -0700 (PDT)
\r
40 <CADv3eywb0tguYowTAK5Ag9YZ48zFZA0QJVNEj_cZcCpr-76Bbg@mail.gmail.com>
\r
41 References: <1335185032-13075-1-git-send-email-felipe.contreras@gmail.com>
\r
42 <CADv3eywAvyMuh3vWLwyuf0Ui_kskwp9875pGxCR1GTm7deN9Pg@mail.gmail.com>
\r
43 <CAMP44s3SyU4WVV0_McHWseNL=jmMnAXO2EdZK4Xk-wrCHPVD8A@mail.gmail.com>
\r
44 <CADv3eywb0tguYowTAK5Ag9YZ48zFZA0QJVNEj_cZcCpr-76Bbg@mail.gmail.com>
\r
45 Date: Tue, 24 Apr 2012 01:45:23 +0300
\r
47 <CAMP44s0=m+PmVBdVytHaYujpaZu=2WH+1F_VoMzpfXH+SS_ZmQ@mail.gmail.com>
\r
48 Subject: Re: [PATCH] ruby: make sure the database is closed
\r
49 From: Felipe Contreras <felipe.contreras@gmail.com>
\r
50 To: Ali Polatel <alip@exherbo.org>
\r
51 Content-Type: text/plain; charset=UTF-8
\r
52 Content-Transfer-Encoding: quoted-printable
\r
53 Cc: notmuch@notmuchmail.org
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Mon, 23 Apr 2012 22:45:28 -0000
\r
68 On Mon, Apr 23, 2012 at 11:43 PM, Ali Polatel <alip@exherbo.org> wrote:
\r
69 > 2012/4/23 Felipe Contreras <felipe.contreras@gmail.com>:
\r
70 >> On Mon, Apr 23, 2012 at 5:04 PM, Ali Polatel <alip@exherbo.org> wrote:
\r
72 >>> I'd rather not do this.
\r
73 >>> Please read: http://comments.gmane.org/gmane.comp.lang.ruby.general/320=
\r
76 >> OK, I've read this.. So?
\r
78 > You are one step close to what I thought you had thought.
\r
80 I don't parse that. I meant that _now_ I've read it.
\r
82 >> The order in which Ruby's garbage-collector frees the database and
\r
83 >> other objects is irrelevant, because with this patch we are not
\r
84 >> manually freeing other objects, only the database.
\r
86 > What I wanted was to make all objects "depending" on the database to be u=
\r
88 > once the database object is freed. Seeing that's not practically easy
\r
89 > I decided to leave
\r
92 Well, sure, but if the user has problems, the user can keep the
\r
93 database object around.
\r
95 Personally I don't see why an object, like say a query would remain
\r
96 working correctly after the database is gone, either by calling
\r
97 .close() directly, or just loosing the pointer to the original object.
\r
98 I don't think users would expect that, or, even if they somehow found
\r
99 it useful, that most likely would be very seldom, and hardly worth
\r
102 >> Sure, it's _better_ if the user calls close(), even better if it's
\r
103 >> inside an 'ensure', and even better if blocks are used (which I am
\r
104 >> using in most cases), but that's not *required*.
\r
106 > If you have such a use case, I'm fine with that patch.
\r
107 > I might push it in the next few days or get someone else to push it.
\r
109 I did at some point, not sure if I do now. But that's beside the
\r
110 point, the point is that it really does happen.
\r
112 >> The user might just do:
\r
115 >> =C2=A0db =3D Notmuch::Database.new($db_name, :mode =3D> Notmuch::MODE_RE=
\r
119 >> That's perfectly fine in Ruby (although not ideal), since 'db' will
\r
120 >> get garbage-collected. But nobody will be able to use the database
\r
121 >> again until that process is killed.
\r
123 >> You think that's correct?
\r
125 > Yes that is correct. I have not thought about this.
\r
126 > I'd say it's a partial misunderstanding on my part due to lack of
\r
127 > (and/or too much) vodka.
\r
129 Well, there's only two options.
\r
134 db =3D Notmuch::Database.new($db_name, :mode =3D> Notmuch::MODE_READ_WR=
\r
138 (as in; the database gets closed eventually)
\r
142 def start_query(search)
\r
143 db =3D Notmuch::Database.new($db_name)
\r
144 return db.query(search)
\r
147 (as in; the query returned would keep working properly)
\r
149 I personally don't see why anybody would want b), and if they have
\r
150 problems with code like that, I think it's obvious to see why.
\r
152 I think we should go for a) and thus apply the patch.
\r