python MySQLDB query timeout

后端 未结 6 1959
误落风尘
误落风尘 2020-12-24 09:45

I\'m trying to enforce a time limit on queries in python MySQLDB. I have a situation where I have no control over the queries, but need to ensure that they do not run over a

6条回答
  •  伪装坚强ぢ
    2020-12-24 09:59

    Why do I not get the signal until after execute finishes?

    The process waiting for network I/O is in an uninterruptible state (UNIX thing, not related to Python or MySQL). It gets the signal after the system call finishes (probably as EINTR error code, although I am not sure).

    Is there another reliable way to limit query execution time?

    I think that it is usually done by an external tool like mkill that monitors MySQL for long running queries and kills them.

提交回复
热议问题