Skip to content

Commit

Permalink
MDL-30026 improve session lock - stronger detection for oracle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 authored and skodak committed Apr 12, 2012
1 parent 54b0eec commit a16230a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/dml/oci_native_moodle_database.php
Expand Up @@ -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) {
Expand Down

0 comments on commit a16230a

Please sign in to comment.