Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: web/inc/logdog-stream-view/logdog-stream-fetcher.html

Issue 2335223003: LogDog: Update web code, stream/query with auth. (Closed)
Patch Set: Fix background page loading. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « web/inc/auth/auth-signin.html ('k') | web/inc/logdog-stream-view/logdog-stream-query.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: web/inc/logdog-stream-view/logdog-stream-fetcher.html
diff --git a/web/inc/logdog-stream-view/logdog-stream-fetcher.html b/web/inc/logdog-stream-view/logdog-stream-fetcher.html
index e17abdbdc615fcbb9821324ff6c5df88ea15c43d..f0d89bb9c19813b4b06c1945d5316fb936edd53e 100644
--- a/web/inc/logdog-stream-view/logdog-stream-fetcher.html
+++ b/web/inc/logdog-stream-view/logdog-stream-fetcher.html
@@ -12,13 +12,14 @@
<script>
"use strict";
- function LogDogFetcher(client, project, path) {
+ function LogDogFetcher(client, stream) {
this.client = client;
- this.project = project;
- this.path = path;
+ this.stream = stream;
// Fetching parameters, will be updated as logs are fetched.
this.sleepTimeSecs = 5;
+ this.byteCount = null;
+ this.logCount = null;
this.reset();
}
@@ -70,6 +71,9 @@
this._nextLogsPromise = null;
return result;
+ }.bind(this)).catch(function(error) {
+ this._nextLogsPromise = null;
+ throw error;
}.bind(this));
}
return this._nextLogsPromise;
@@ -93,10 +97,10 @@
}
var logs = resp.logs;
- if (!logs.length) {
+ if (! (logs && logs.length)) {
// No logs were loaded this round. Sleep for a bit then try again.
// (Streaming case).
- console.log("No logs for", this.path, "; sleeping...");
+ console.log("No logs for", this.stream, "; sleeping...");
return new LuciSleepPromise(this.sleepTimeSecs * 1000).
then(function() {
return this._fetchNextBatch();
@@ -121,12 +125,19 @@
this.client.service = "logdog.Logs";
this.client.method = "Get";
this.client.request = {
- project: this.project,
- path: this.path,
+ project: this.stream.project,
+ path: this.stream.path,
state: (!this.state || this.terminalIndex() < 0),
index: this.nextIndex,
};
+ if (this.byteCount !== null) {
+ this.client.request.byteCount = this.byteCount;
+ }
+ if (this.logCount !== null) {
+ this.client.request.logCount = this.logCount;
+ }
+
return this.client.call().completes.then(function(resp) {
resp = resp.response;
@@ -146,6 +157,8 @@
}
return resp;
+ }, function(error) {
+ throw LogDogError.wrapGrpc(error);
});
};
</script>
« no previous file with comments | « web/inc/auth/auth-signin.html ('k') | web/inc/logdog-stream-view/logdog-stream-query.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698