Skip to content

Commit

Permalink
Cancellable pods list requests
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti committed Apr 29, 2021
1 parent 5592183 commit 2731cd8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/ui/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,12 @@ class Dashboard extends EventEmitter {
this.run = function (namespace) {
current_namespace = namespace;
let listPodsError;
// FIXME: should be cancellable
const promise = until(client.pods(namespace).get())
let { promise, cancellation } = client.pods(namespace).get({ cancellable: true });
cancellations.add('dashboard.pods', cancellation);
promise = until(promise)
.do(pods_table, pods_table.setLabel)
.spin(s => `${s} Pods {grey-fg}[${namespace}]{/grey-fg}`)
.cancel(c => cancellations.add('dashboard.pods', c))
.done(_ => `Pods {grey-fg}[${namespace}]{/grey-fg}`)
.then(response => {
pods_list = JSON.parse(response.body.toString('utf8'));
Expand All @@ -740,7 +742,7 @@ class Dashboard extends EventEmitter {
yield* watchPodChanges(namespace);
}
});
cancellations.add('dashboard', cancellation);
cancellations.add('dashboard.pods', cancellation);
return promise;
})
.catch(error => {
Expand Down

0 comments on commit 2731cd8

Please sign in to comment.