Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(config): Add none force-refresh option for auto refresh #17039

Merged
merged 4 commits into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,19 @@ class Header extends React.PureComponent {
});
this.props.addWarningToast(
t(
`This dashboard is currently force refreshing; the next force refresh will be in %s.`,
`This dashboard is currently auto refreshing; the next auto refresh will be in %s.`,
intervalMessage,
),
);

if (dashboardInfo.common.conf.DASHBOARD_AUTO_REFRESH_MODE === 'fetch') {
// force-refresh while auto-refresh in dashboard
return fetchCharts(
affectedCharts,
false,
interval * 0.2,
dashboardInfo.id,
);
}
return fetchCharts(
affectedCharts,
true,
Expand Down
14 changes: 13 additions & 1 deletion superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@
import sys
from collections import OrderedDict
from datetime import date, timedelta
from typing import Any, Callable, Dict, List, Optional, Type, TYPE_CHECKING, Union
from typing import (
Any,
Callable,
Dict,
List,
Literal,
Optional,
Type,
TYPE_CHECKING,
Union,
)

from cachelib.base import BaseCache
from celery.schedules import crontab
Expand Down Expand Up @@ -692,6 +702,8 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
SQLLAB_SAVE_WARNING_MESSAGE = None
SQLLAB_SCHEDULE_WARNING_MESSAGE = None

# Force refresh while auto-refresh in dashboard
DASHBOARD_AUTO_REFRESH_MODE: Literal["fetch", "force"] = "force"

# Default celery config is to use SQLA as a broker, in a production setting
# you'll want to use a proper broker as specified here:
Expand Down
1 change: 1 addition & 0 deletions superset/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"SQLALCHEMY_DOCS_URL",
"SQLALCHEMY_DISPLAY_TEXT",
"GLOBAL_ASYNC_QUERIES_WEBSOCKET_URL",
"DASHBOARD_AUTO_REFRESH_MODE",
)
logger = logging.getLogger(__name__)

Expand Down