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: emacsql-mysql - best way to close connection? Date: Sat, 01 Apr 2017 09:14:06 +0200 Message-ID: <8660ioy4zl.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1491053093 20435 195.159.176.226 (1 Apr 2017 13:24:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Apr 2017 13:24:53 +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:24:45 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 1cuJ1F-00048Y-T9 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 15:24:42 +0200 Original-Received: from localhost ([::1]:51321 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuJ1K-0000AA-76 for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Apr 2017 09:24:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cuDEk-0001jZ-Hq for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 03:14:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cuDEf-0004d1-Qb for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 03:14:14 -0400 Original-Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:32778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cuDEf-0004cg-KI for help-gnu-emacs@gnu.org; Sat, 01 Apr 2017 03:14:09 -0400 Original-Received: by mail-wm0-x22c.google.com with SMTP id v203so2469941wmg.0 for ; Sat, 01 Apr 2017 00:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=UhiXg+6qgHRcP04M9YUEmDp4njcUBNLqaaStDnLloMw=; b=g8ZjDxOCNa9wKZZ9pxc5s8gTIyvvVfMSCMV5Ga8qHT2rYrDFXiMrB+G/r17Wbe14/W BHHcKl8vAJ6yltqpdKyP9YSecq7701YtT0chcG8ypvz9UFvyUTWVnTv17TAJK5rBBMa9 c+iWaxEfZ4fAXnuoI7BYQ/y9nmzlwqpz7sHV8aF1XX2nSJRDJJuM5OajTTJnQ+vdFpdS VGU3OGCw04hBvIB/nBvold/tiG6n/io40KSLgOwHFllwJQByCxq6bEg6yNRobejzdGc5 GFUoRroCxn6GCCiCJMQmJwAXHoQyRW3QyUZUc7jv/V8+Qo8Ay4L5/Ramd70YiZ84gaim FcgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=UhiXg+6qgHRcP04M9YUEmDp4njcUBNLqaaStDnLloMw=; b=WOw989AygAp2NVx0ka+mklagkFzqkk5QbGvYv+Er0bekf2vmwdV27MivVm2sutp4h3 KOTMBVto++m8L9P6yfZv3c72cG3ka6AprU0z5ZZW4YQk6YKMs2W6Ak/XsX+HBuM4qviN FQxokQkmUfAUNNO1o37M4rujHHqtkezK9GoaQ/6rpYSaz6XxIY27CFqdHUB0ajP0+6EY xqzbVUzJ00gAe0mciLMMxO+Gxuj4oL2iCokGUWrkVORDbSrdTYPk4RUbT8K1UiE6/V0j T99iBaPw3fsBjX1oGnNzC/9XDd7QNz4xMcUdiARa+yNaTFqSlNkxS2/+QtgrguI4SDyU ex/Q== X-Gm-Message-State: AFeK/H3QgMv++EqYLH1HTf1mlry0lJaXsqtcptXoySyAj7LBwGEDK88/ bkv4supMhCdMKQ== X-Received: by 10.28.91.1 with SMTP id p1mr1241258wmb.63.1491030848604; Sat, 01 Apr 2017 00:14:08 -0700 (PDT) Original-Received: from jut (78-21-105-104.access.telenet.be. [78.21.105.104]) by smtp.gmail.com with ESMTPSA id m14sm9476039wrb.22.2017.04.01.00.14.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Apr 2017 00:14:06 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22c X-Mailman-Approved-At: Sat, 01 Apr 2017 09:24:19 -0400 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:112671 Archived-At: 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. Please advise. TIA, -- Guido After Donald Trump's stretch limousine was stolen and found undamaged a few blocks away; he said, "Nothing was stolen. I had an honest thief."-International Herald Tribune, page 3, March 2, 1992