all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Guido Van Hoecke <guivho@gmail.com>
To: Emacs <help-gnu-emacs@gnu.org>,
	Christopher Wellons <wellons@nullprogram.com>
Subject: Re: emacsql-mysql - best way to close connection?
Date: Sat, 1 Apr 2017 11:54:10 +0200	[thread overview]
Message-ID: <CAEySM9F2GFsyVOYDQLeiuNeuuq3qZN6RL-Zc4Zk7bX0=n3L-7w@mail.gmail.com> (raw)
In-Reply-To: <8660ioy4zl.fsf@gmail.com>

Hi,



On 1 April 2017 at 09:14, Guido Van Hoecke <guivho@gmail.com> wrote:

> Hi,
>
> I create a mysql connection in a let* form:
>
> (let* ((host "mysql.host.com")
>        (dummy (netrc-credentials host)) ;; needed to define remaining
> netrc stuff
>        (info (netrc-machine (netrc-parse (expand-file-name "~/.netrc"))
> host))
>        (id (cdr (assoc "login" info)))
>        (pw (cdr (assoc "password" info)))
>        (db (emacsql-mysql "database" :user id :password pw :host host)))
>    ....)
>
> Somehow I hoped that the connection would go away when the let* form
> finishes but the connection does survive. The documentation at
> [[https://github.com/skeeto/emacsql][EmacSQL]] does mention: 'It works
> by maintaining a inferior process running (a "connection") for
> interacting with the back-end database. Connections are automatically
> cleaned up if they are garbage collected. All requests are synchronous.'
>
> Each time the form is executed, a new connection is created. Typically
> this happens once a day, but by the end of the week it accumulates 7
> open connections :(
>
> There's probably a better way to create and close connections, but up to
> now I have not been able to find relevant documentation.
>

I added (delete-process "emacsql-mysql") as last elisp form of the let*
form. This does kill the process. Still I wonder if this is the way to go?

-- 
Guido

I fell asleep reading a dull book, and I dreamt that I was reading on,
so I woke up from sheer boredom.


  reply	other threads:[~2017-04-01  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-01  7:14 emacsql-mysql - best way to close connection? Guido Van Hoecke
2017-04-01  9:54 ` Guido Van Hoecke [this message]
2017-04-01 19:52   ` John Mastro
2017-04-02 11:31     ` Guido Van Hoecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEySM9F2GFsyVOYDQLeiuNeuuq3qZN6RL-Zc4Zk7bX0=n3L-7w@mail.gmail.com' \
    --to=guivho@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=wellons@nullprogram.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.