mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
auto-refresh data RQ jobs admin page (#4298)
This commit is contained in:
parent
80878abf7b
commit
f19d24287e
@ -25,20 +25,29 @@ class Jobs extends React.Component {
|
||||
workers: [],
|
||||
};
|
||||
|
||||
_refreshTimer = null;
|
||||
|
||||
componentDidMount() {
|
||||
recordEvent('view', 'page', 'admin/rq_status');
|
||||
$http
|
||||
.get('/api/admin/queries/rq_status')
|
||||
.then(({ data }) => this.processQueues(data))
|
||||
.catch(error => this.handleError(error));
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
// Ignore data after component unmounted
|
||||
clearTimeout(this._refreshTimer);
|
||||
this.processQueues = () => {};
|
||||
this.handleError = () => {};
|
||||
}
|
||||
|
||||
refresh = () => {
|
||||
$http
|
||||
.get('/api/admin/queries/rq_status')
|
||||
.then(({ data }) => this.processQueues(data))
|
||||
.catch(error => this.handleError(error));
|
||||
|
||||
this._refreshTimer = setTimeout(this.refresh, 60 * 1000);
|
||||
};
|
||||
|
||||
processQueues = ({ queues, workers }) => {
|
||||
const queueCounters = values(queues).map(({ started, ...rest }) => ({
|
||||
started: started.length,
|
||||
|
Loading…
Reference in New Issue
Block a user