labthings / labthings/python-labthings
Changing `ActionView._deque.maxlen` in subclasses
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 19
- Forks
- 2
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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 :)
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem Lesen der ActionView-Implementierung, insbesondere von init_subclass und dem Initialisierungspfad von _deque. Reproduziere die Unterklassenbeispiele aus dem Issue und untersuche, wie die Anfrageverarbeitung die Queue verwendet. Die Umsetzung sollte eine unterstützte Queue-Länge auf Unterklassenebene ermöglichen, ohne dass Anfragen hängen bleiben, und Tests enthalten, die das konfigurierte Maximum abdecken.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 30/100