 
 (defn select-project
   [ext project-id]
-  (db/with-conn
-    (db/set-extension-config! (ext :id) :project-id project-id))
+  (db/set-extension-config! (ext :id) :project-id project-id)
   (register-webhook (ext :id) project-id)
   (edn-response {:ok true}))
 

  [extension event-req]
  (if-let [secret (get-in event-req [:headers "x-hook-secret"])]
    (do (timbre/debugf "webhook handshake for %s" (extension :id))
        (db/with-conn
          (db/set-extension-config! (extension :id) :webhook-secret secret))
      {:status 200 :headers {"X-Hook-Secret" secret}})
    (if-let [signature (get-in event-req [:headers "x-hook-signature"])]
      (let [body (:body event-req)

                          (.startsWith (story-data "text") comment-prefix))
              (timbre/debugf "new comment %s" story story-data)
              ; TODO: check to make sure comment wasn't one we sent
              (db/create-message! {:thread-id thread-id
                                   :id (db/uuid)
                                   :content (format issue-comment-format
                                              (get-in story-data ["created_by" "name"])
                                              (story-data "text"))
                                   :user-id (extension :user-id)
                                   :group-id (extension :group-id)
                                   :created-at (java.util.Date.)
                                   :mentioned-user-ids ()
                                   :mentioned-tag-ids ()})
              (sync/broadcast-thread thread-id ())))
          (timbre/warnf "No existing thread for resource %s" resource))))))

