Changing `ActionView._deque.maxlen` in subclasses
還沒有人認領這個 Issue。
評估
研究方向
先閱讀 ActionView 的實作,尤其是 init_subclass 和 _deque 的初始化路徑。重現 issue 中的子類別範例,並檢查請求處理如何使用佇列。完成後應提供受支援的子類別層級佇列長度,同時不會讓請求卡住,並包含涵蓋已設定最大值的測試。
由索引模型根據 Issue 內容生成。
描述
Is your feature request related to a problem? Please describe.
I tried to lower the length of the ActionView _deque but could not find a way that would not result in a bug
Describe the solution you'd like
I would like to have a method to specify the ActionView queue length, ideally at the subclass definition level.
Describe alternatives you've considered
I tried:
- Changing the class attribute
class MyAction(ActionView):
args = {
"averages": fields.Integer(
missing=20,
example=20,
description="Number of images to average over",
)
}
# Marshal the response as a string representation of the array
schema = fields.String()
_deque = Deque(maxlen=10)
...
I believe this is rendered useless by the __init_subclass__ method.
- Overwritting the
_dequeat init:
class MyAction(ActionView):
args = {
"averages": fields.Integer(
missing=20,
example=20,
description="Number of images to average over",
)
}
# Marshal the response as a string representation of the array
schema = fields.String()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._deque = Deque(maxlen=10)
...
This solution is causing the request to hang.
I also tried subclassing __init_subclass__ (?) but to no avail.
Thanks again for your work, sorry for the spam today :)
- 主要語言
- Python
- 星號
- 19
- 分支
- 2
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
labthings/python-labthings 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 35/100
labthings/python-labthings#324 ·
-
難度 5/5 一週以上 新手友好度 20/100
labthings/python-labthings#323 · 3 則留言 ·
-
難度 5/5 一週以上 新手友好度 15/100
labthings/python-labthings#302 · 2 則留言 ·
-
難度 5/5 一週以上 新手友好度 25/100
labthings/python-labthings#237 · 3 則留言 ·
-
難度 4/5 3-5 天 新手友好度 35/100
查看 labthings/python-labthings 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 3 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
modelcontextprotocol/python-sdk#3648 ·
維護者通常 1 天內回覆
-
docs good first issue
難度 2/5 1-3 小時 新手友好度 78/100
VenetoStato/giorgio#6 ·
-
難度 2/5 1-3 小時 新手友好度 74/100
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 70/100
EclipseFdn/open-vsx.org#13831 ·
維護者通常 1 天內回覆