Skip to content
Browse files

MDL-30026 improve session lock - stronger detection for oracle

  • Loading branch information...
1 parent 54b0eec commit a16230a69b2638e23041e4c2ace6ff738e03c791 @stronk7 stronk7 committed with skodak Nov 13, 2011
Showing with 3 additions and 7 deletions.
  1. +3 −7 lib/dml/oci_native_moodle_database.php
View
10 lib/dml/oci_native_moodle_database.php
@@ -1625,16 +1625,12 @@ public function get_session_lock($rowid, $timeout) {
$this->query_start($sql, $params, SQL_QUERY_AUX);
$stmt = $this->parse_query($sql);
$this->bind_params($stmt, $params);
- $start = time();
$result = oci_execute($stmt, $this->commit_status);
- $end = time();
- $this->query_end($result, $stmt);
- oci_free_statement($stmt);
-
- if ($end - $start >= $timeout) {
- //TODO: there has to be a better way to find out if lock obtained
+ if ($result === false) { // Any failure in get_lock() raises error, causing return of bool false
throw new dml_sessionwait_exception();
}
+ $this->query_end($result, $stmt);
+ oci_free_statement($stmt);
}
public function release_session_lock($rowid) {

0 comments on commit a16230a

Please sign in to comment.
Something went wrong with that request. Please try again.