Clear timeout when reloading the buildbucket plugin

+ This was causing extra requests to be sent when the user changed
  the patch number in the change, which meant that the element was
  not detached so existing timers were still present.
+ Also adjusted horizontal padding to be in line with new UI changes
  even though it shouldn’t have much of an effect since it’s going
  to use the app’s CSS variable anyway.

Change-Id: Ie4d229c31fd244373df1f6ee6a57ac13fbd7ee9f
diff --git a/src/main/resources/static/cr-buildbucket-view.html b/src/main/resources/static/cr-buildbucket-view.html
index 639183c..b62d87c 100644
--- a/src/main/resources/static/cr-buildbucket-view.html
+++ b/src/main/resources/static/cr-buildbucket-view.html
@@ -8,7 +8,7 @@
     <style>
       :host {
         display: block;
-        margin: 1em var(--default-hozizontal-margin, 1.25rem);
+        margin: 1em var(--default-hozizontal-margin, 1rem);
       }
       gr-button {
         font-size: .9em;
diff --git a/src/main/resources/static/cr-buildbucket-view.js b/src/main/resources/static/cr-buildbucket-view.js
index d1b8ba0..a679948 100644
--- a/src/main/resources/static/cr-buildbucket-view.js
+++ b/src/main/resources/static/cr-buildbucket-view.js
@@ -60,6 +60,7 @@
         type: Number,
         value: DEFAULT_UPDATE_INTERVAL_MS,
       },
+      _updateTimeoutID: Number,
     },
 
     attached: function() {
@@ -68,10 +69,12 @@
 
     detached: function() {
       this.unlisten(document, 'visibilitychange', '_handleVisibilityChange');
+      window.clearTimeout(this._updateTimeoutID);
     },
 
     reload: function() {
       this._loading = true;
+      window.clearTimeout(this._updateTimeoutID);
       this._refreshBuildResults().then(function() {
         this._loading = false;
       }.bind(this));
@@ -109,8 +112,9 @@
         this._updateIntervalMs = Math.min(MAX_UPDATE_INTERVAL_MS,
             (1 + Math.random()) * this._updateIntervalMs * 2);
       }.bind(this)).then(function() {
-        window.setTimeout(this._updateTimerFired.bind(this),
-            this._updateIntervalMs);
+        this._updateTimeoutID =
+            window.setTimeout(this._updateTimerFired.bind(this),
+                this._updateIntervalMs);
       }.bind(this));
     },