Uploaded image for project: 'Project Quay'
  1. Project Quay
  2. PROJQUAY-790

SPIKE: Evaluate options for adding connection testing to playhouse.pool.PooledMySQLDatabase

    XMLWordPrintable

Details

    • Task
    • Resolution: Won't Do
    • Major
    • None
    • None
    • None
    • 0

    Description

      One suggestion raised was to consider adding a check statement to connections to ensure the database is in good shape before trying to connect- something like (pseudo-python):
      from playhouse.pool import PooledMySQLDatabase
      class CheckedPooledMySQLDatabase(PooledMySQLDatabase):
      def connect(self, reuse_if_open):
      connection = super(PooledMySQLDatabase, self).connect(reuse_if_open)
      try:
      if connection.execute("SELECT 1"):
      return connection
      else:
      connection.manual_close()
      return None
      except e:
      pass
      return None
      Task is to try this out & see if it possibly prevents connections from blocking.

       

      http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#PooledMySQLDatabase

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            bdettelb@redhat.com Bill Dettelback
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: