mirror of
https://github.com/apache/superset.git
synced 2026-04-20 16:44:46 +00:00
fix: Chart cache-warmup task fails on Superset 4.0 (#28706)
This commit is contained in:
@@ -29,6 +29,7 @@ from superset.models.core import Log
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from superset.tags.models import Tag, TaggedObject
|
||||
from superset.tasks.utils import fetch_csrf_token
|
||||
from superset.utils import json
|
||||
from superset.utils.date_parser import parse_human_datetime
|
||||
from superset.utils.machine_auth import MachineAuthProvider
|
||||
@@ -219,7 +220,10 @@ def fetch_url(data: str, headers: dict[str, str]) -> dict[str, str]:
|
||||
"""
|
||||
result = {}
|
||||
try:
|
||||
url = get_url_path("Superset.warm_up_cache")
|
||||
# Fetch CSRF token for API request
|
||||
headers.update(fetch_csrf_token(headers))
|
||||
|
||||
url = get_url_path("ChartRestApi.warm_up_cache")
|
||||
logger.info("Fetching %s with payload %s", url, data)
|
||||
req = request.Request(
|
||||
url, data=bytes(data, "utf-8"), headers=headers, method="PUT"
|
||||
|
||||
Reference in New Issue
Block a user