Page MenuHomePhabricator

D19823.id47346.diff
No OneTemporary

D19823.id47346.diff

diff --git a/src/aphront/storage/connection/AphrontDatabaseConnection.php b/src/aphront/storage/connection/AphrontDatabaseConnection.php
--- a/src/aphront/storage/connection/AphrontDatabaseConnection.php
+++ b/src/aphront/storage/connection/AphrontDatabaseConnection.php
@@ -93,6 +93,27 @@
throw new Exception(pht('Async queries are not supported.'));
}
+ /**
+ * Is this connection idle and safe to close?
+ *
+ * A connection is "idle" if it can be safely closed without loss of state.
+ * Connections inside a transaction or holding locks are not idle, even
+ * though they may not actively be executing queries.
+ *
+ * @return bool True if the connection is idle and can be safely closed.
+ */
+ public function isIdle() {
+ if ($this->isInsideTransaction()) {
+ return false;
+ }
+
+ if ($this->isHoldingAnyLock()) {
+ return false;
+ }
+
+ return true;
+ }
+
/* -( Global Locks )------------------------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 7, 6:43 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7324653
Default Alt Text
D19823.id47346.diff (1007 B)

Event Timeline