Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15308843
D19823.id47346.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1007 B
Referenced Files
None
Subscribers
None
D19823.id47346.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D19823: Define "idle" connections that are safe to close (no transactions, no held locks)
Attached
Detach File
Event Timeline
Log In to Comment