Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/downloader.js

Issue 6013081427640320: Issue 537 - Mark first few downloads (Closed)
Patch Set: Created Nov. 10, 2014, 5:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/notification.js » ('j') | lib/notification.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/downloader.js
===================================================================
--- a/lib/downloader.js
+++ b/lib/downloader.js
@@ -197,7 +197,8 @@
"&applicationVersion=" + encodeURIComponent(applicationVersion) +
"&platform=" + encodeURIComponent(platform) +
"&platformVersion=" + encodeURIComponent(platformVersion) +
- "&lastVersion=" + encodeURIComponent(downloadable.lastVersion);
+ "&lastVersion=" + encodeURIComponent(downloadable.lastVersion) +
+ "&downloadCount=" + encodeURIComponent(downloadable.downloadCount);
return url;
},
@@ -291,6 +292,10 @@
return;
}
+ // We limit the download count to 5+ to keep the request anonymized
+ if (!isNaN(downloadable.downloadCount) && ++downloadable.downloadCount > 5)
+ downloadable.downloadCount = "5+";
Wladimir Palant 2014/11/10 19:18:15 Storing numbers and strings in the same variable s
Thomas Greiner 2014/11/11 11:54:46 What I wanted to avoid is (a) stopping the counter
Wladimir Palant 2014/11/11 16:07:00 Yes, I was also considering whether (b) is a probl
Thomas Greiner 2014/11/11 17:17:18 Done.
+
this.onDownloadSuccess(downloadable, request.responseText, errorCallback, function redirectCallback(url)
{
if (redirects >= this.maxRedirects)
@@ -378,4 +383,10 @@
* @type Integer
*/
hardExpiration: 0,
+
+ /**
+ * Number indicating how often the object was downloaded.
+ * @type Integer
+ */
+ downloadCount: 1,
Thomas Greiner 2014/11/10 18:14:55 This number is always one higher than the number o
Wladimir Palant 2014/11/10 19:18:15 Incrementing after success seems ok, but why not s
Thomas Greiner 2014/11/11 11:54:46 If this is set to 0 then the number we send is 0-b
Wladimir Palant 2014/11/11 16:07:00 I don't think we actually agreed on the exact mean
Thomas Greiner 2014/11/11 17:17:18 Done.
};
« no previous file with comments | « no previous file | lib/notification.js » ('j') | lib/notification.js » ('J')

Powered by Google App Engine
This is Rietveld