From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Guido Van Hoecke Newsgroups: gmane.emacs.help Subject: Re: emacsql-mysql - best way to close connection? Date: Sat, 1 Apr 2017 11:54:10 +0200 Message-ID: References: <8660ioy4zl.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1491053162 12789 195.159.176.226 (1 Apr 2017 13:26:02 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Apr 2017 13:26:02 +0000 (UTC) To: Emacs , Christopher Wellons Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 01 15:25:52 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cuJ2G-0001pw-3i for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 15:25:44 +0200 Original-Received: from localhost ([::1]:51330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJ2M-0000jJ-54 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 09:25:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuFk3-0006B2-Q2 for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 05:54:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuFk2-0005tT-CF for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 05:54:43 -0400 Original-Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34459) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuFk2-0005tD-5n for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 05:54:42 -0400 Original-Received: by mail-wm0-x234.google.com with SMTP id w204so2810820wmd.1 for ; Sat, 01 Apr 2017 02:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=2JgcFpbmgECYvj+LumtjhwDT472o/V1GZhc1XPDiXtc=; b=dVHcD8ZXoK/VO1QiQ+nB5Q2gycI+e7Wtncbaq2usKPjIeZ8ht8IWMJPjh+M4vSg2WV JupBPe2cSRGSgoPDMhqwutLxBNEtnIt735exjZ72rf6F6XlC2M3HaTNS1nrLZZRhD4Sx GhRrPrRHTFNUDEkW2KS3vJJqAnXQA0wuhhlSPYk2AHaex+TUhPSr2LmrUV0WVkgSip56 kXG69/9PXyWgPlfHahvxcEwbddsniXjPfX9upMhTBJOJov8GgQn4YIMCPpT1U94Eh1eA E5cBiN+6uk3ok1MEQ6eBpeT4kbmme3wQklvzbAqFISHmF2wNhTIxvSQiLFN2Y6kzWXbz R4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=2JgcFpbmgECYvj+LumtjhwDT472o/V1GZhc1XPDiXtc=; b=k4FPhSNAL/LTEAz6gINqfq2Dni5NV541JHKugnVrAEM0ToK39UmGyUADIc+Vwdrb87 YIQirl+q3AYrtXpiUbCFHTUw4+7M4xXF5U6ld3sraebHjTMF22DEFbrgeb4yvRc8POon UXvnmDCsXSthQaCYnuAErAOvsSf+YUl3UYGTHWT7HlfEJKWootDLU4Qp1xoq6057qdK3 jSa8510HH5qVf49GPU24obpryU22NtMOClypbto9/ILJ7rtsgz7cU4/XcUHpzWz1SrhP lL20E6m9EuLFiwLOaUDo2QUfXlEE9+Jbe01pVOAGY1fxYXP4IONcr+BprrPZ0nf0Nlac Rdbw== X-Gm-Message-State: AFeK/H319KN9a4pSAKIe5xWQ0FDgx5fZz+v4ky0CdFyEfatzUVHkzCEK nSC6AI2g6ySuR7tcDBbPuHv+AcVsUryy X-Received: by 10.28.47.205 with SMTP id v196mr1925481wmv.20.1491040480850; Sat, 01 Apr 2017 02:54:40 -0700 (PDT) Original-Received: by 10.28.6.143 with HTTP; Sat, 1 Apr 2017 02:54:10 -0700 (PDT) In-Reply-To: <8660ioy4zl.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::234 X-Mailman-Approved-At: Sat, 01 Apr 2017 09:24:19 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112672 Archived-At: Hi, On 1 April 2017 at 09:14, Guido Van Hoecke 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.