-
Notifications
You must be signed in to change notification settings - Fork 15.3k
fix: intermittent retrieval error under high concurrency #33895
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,18 +17,22 @@ | |||||
# pylint: disable=too-many-lines | ||||||
from __future__ import annotations | ||||||
|
||||||
import copy | ||||||
import logging | ||||||
from datetime import datetime | ||||||
from io import BytesIO | ||||||
from typing import Any, Callable, Dict | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extraneous import
Suggested change
|
||||||
from typing import Any, Callable | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
from zipfile import is_zipfile, ZipFile | ||||||
|
||||||
from flask import request, Response, send_file | ||||||
from flask_appbuilder.api import expose, protect, rison, safe | ||||||
from flask_appbuilder.api.schemas import get_item_schema | ||||||
from flask_appbuilder.models.filters import Filters | ||||||
from flask_appbuilder.const import ( | ||||||
API_RESULT_RES_KEY, | ||||||
API_SELECT_COLUMNS_RIS_KEY, | ||||||
API_FILTERS_RIS_KEY, | ||||||
) | ||||||
from flask_appbuilder.models.sqla.interface import SQLAInterface | ||||||
from flask_babel import ngettext | ||||||
|
@@ -299,6 +303,32 @@ | |||||
list_outer_default_load = True | ||||||
show_outer_default_load = True | ||||||
|
||||||
def _handle_filters_args(self, rison_args: Dict[str, Any]) -> Filters: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the new function here, is it being called anywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's likely an override for existing FAB method. |
||||||
""" | ||||||
Handle filters arguments passed to the API endpoint. | ||||||
Parses and applies filtering criteria provided as Rison-encoded arguments | ||||||
to construct a Filters instance. This method ensures that each request | ||||||
uses an isolated Filters instance to avoid shared state issues | ||||||
in concurrent or asynchronous environments. | ||||||
Example input: | ||||||
rison_args = { | ||||||
"filters": [ | ||||||
{"col": "table_name", "opr": "eq", "value": "some_table"} | ||||||
] | ||||||
} | ||||||
:param rison_args: A dictionary of arguments parsed from the API request'sAdd commentMore actions | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: indent this sentence to be on par with remaining comments
Suggested change
|
||||||
Rison-encoded `q` parameter. | ||||||
:returns: A Filters instance containing the applied filters. | ||||||
""" | ||||||
filters = self.datamodel.get_filters( | ||||||
search_columns=self.search_columns, search_filters=self.search_filters | ||||||
) | ||||||
# self._filters.clear_filters() | ||||||
filters.rest_add_filters(rison_args.get(API_FILTERS_RIS_KEY, [])) | ||||||
return filters.get_joined_filters(self._base_filters) | ||||||
|
||||||
@expose("/", methods=("POST",)) | ||||||
@protect() | ||||||
@safe | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This import is not being used anywhere. Should be removed