Skip to content

timeout-decorator doesn't work with mysql-connection-python CMySQLConnection #86

@ToanLyHoa

Description

@ToanLyHoa
# mysql.connector version 9.0.0

@timeout_decorator.timeout(timeout=5, 
                          timeout_exception=ConnectionError) 
def connect_database(self) -> None:
    
      connection = mysql.connector.connect(
          host=self.host,
          port=self.port,
          user=self.user,
          password=self.password,
          database=self.database,
          # default
          use_pure = False,
      )
    

The code above doesn't work, maybe in CMySQLConnection write in C they set signal.alarm(0) when we don't pass connection_timeout in this connect function..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions