1351: _checkForUpdates runs with 0 interval.

sitnikov*********@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Oct. 11, 2009
What version are you running?
1.1 alpha 2(dev)

What's the URL of the page containing the problem?
http://reviews.review-board.org/r/2168/diff


What steps will reproduce the problem?
1. Open "view diff" page for any review request
2. Wait 5-10 minutes
3. 17 records per second appear in access_log: 
GET /api/json/reviewrequests/2168/last-update/?dummy= HTTP/1.1

What is the expected output? What do you see instead?
There should be an interval of RB.ReviewRequest.CHECK_UPDATES_MSECS 
between two lines of "/api/json/.../last-update/"

What operating system are you using? What browser?
Does not matter. I use FireFox, Safari.

Please provide any additional information below.
I believe, the following fragment should be changed:
                setTimeout(function() { self._checkForUpdates(); },
                           self.CHECK_UPDATES_MSECS);
"self.CHECK_UPDATES_MSECS" should be replaced with 
RB.ReviewRequest.CHECK_UPDATES_MSECS
From d1561c56e4faf140cdafc8089e60934148a03c87 Mon Sep 17 00:00:00 2001
From: Vladimir Sitnikov <sitnikov@netcracker.com>
Date: Thu, 8 Oct 2009 11:47:57 +0400
Subject: [PATCH] Fix self.CHECK_UPDATES_MSECS to RB.ReviewRequest.CHECK_UPDATES_MSECS
---
 reviewboard/htdocs/media/rb/js/datastore.js |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/reviewboard/htdocs/media/rb/js/datastore.js b/reviewboard/htdocs/media/rb/js/datastore.js
index 3542d76..ee561b6 100644
--- a/reviewboard/htdocs/media/rb/js/datastore.js
+++ b/reviewboard/htdocs/media/rb/js/datastore.js
@@ -349,7 +349,7 @@ $.extend(RB.ReviewRequest.prototype, {
                 self.lastUpdateTimestamp = rsp.timestamp;
 
                 setTimeout(function() { self._checkForUpdates(); },
-                           self.CHECK_UPDATES_MSECS);
+                           RB.ReviewRequest.CHECK_UPDATES_MSECS);
             }
         });
     },
-- 
1.6.0.2.1172.ga5ed0
chipx86
#1 chipx86
When is your install from? You don't say which version. It never said
"self.CHECK_UPDATES_MSECS," but "this.CHECK_UPDATES_MSECS" and actually worked fine.
We did just change the logic, but it's still fine. Did you modify your copy at all?
  • +NeedInfo
#2 sitnikov*********@gmai***** (Google Code) (Is this you? Claim this profile.)
Actually, I use the "master" branch from the official git repository
(http://github.com/reviewboard/reviewboard.git)

Here is the link to the source:
http://github.com/reviewboard/reviewboard/blob/10b5857f676c598fb6353bb50b54a9f0410f032f/reviewboard/htdocs/media/rb/js/datastore.js#L352

I am not sure whether "this" is much better or not, but I used "RB.ReviewRequest." to
be consistent with commit eb6d4c4673983e6901cd9cf7d1893e390c3ff222
chipx86
#3 chipx86
Ahh, I see. I was on a branch with other changes and had this fix. Sorry about that :)

Thanks, this is now committed on master (r5840b26)
  • -NeedInfo
    +Fixed
  • -Priority-Medium
    +Priority-High
    +Component-Reviews
  • +chipx86