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

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

XMLWordPrintable

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

      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

       

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

                Created:
                Updated:
                Resolved: