refactor(web/panettone): Use postmodern connection pools

Instead of managing Postgres connections on our own, use the
`with-connection` postmodern function with pooling enabled as a route
decorator.

This should resolve at least some of the issues from b/113 with
leaking connections, and an unreported issue with connections being
reused while transactions are in progress.

Change-Id: I1ed68667a3240900de1ae69df37d2d3018caf204
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5198
Tested-by: BuildkiteCI
Reviewed-by: eta <tvl@eta.st>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2022-02-03 02:18:09 +03:00 committed by clbot
parent b7be2660c9
commit fe290a5ff8
3 changed files with 60 additions and 59 deletions

View file

@ -32,7 +32,9 @@
(:use :cl :panettone.util :klatre :postmodern :iterate)
(:import-from :alexandria :if-let :when-let :define-constant)
(:export
:connect-postgres :ddl/init :make-thread
:prepare-db-connections
:ddl/init
:*pg-spec*
:user-settings
:user-dn :enable-email-notifications-p :settings-for-user
@ -76,7 +78,7 @@
:panettone.model
:id :subject :body :author-dn :issue-id :status :created-at
:field :previous-value :new-value :acting-user-dn
:issue-comments :num-comments :issue-events)
:*pg-spec*)
(:import-from :panettone.irc :send-irc-notification)
(:shadow :next)
(:export :start-pannetone :config :main))