From 1289250763db2cd9e06a62cedf70123ef79f7bc5 Mon Sep 17 00:00:00 2001 From: "yuri.bakumenko" Date: Fri, 23 Oct 2015 16:31:03 -0400 Subject: [PATCH] added a more like workaround rather than a perfect fix to re-enable timeouts for query as reported at https://github.com/iwind/rockmongo/issues/114 --- app/lib/mongo/RQuery.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/lib/mongo/RQuery.php b/app/lib/mongo/RQuery.php index cac2510..15af7a3 100644 --- a/app/lib/mongo/RQuery.php +++ b/app/lib/mongo/RQuery.php @@ -363,6 +363,10 @@ function hint($hint) { */ function cursor() { $cursor = $this->_collection->find($this->criteria(), $this->_results); + $cursor -> timeout(MServer::currentServer()->mongoTimeout()); + if (method_exists($cursor,'maxTimeMS')) { + $cursor -> maxTimeMS(MServer::currentServer()->mongoTimeout()); + } if ($this->_offset >= 0) { $cursor->skip($this->_offset); } @@ -598,4 +602,4 @@ function db() { } } -?> \ No newline at end of file +?>