Implementation of websocket API for importer
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
I'm playing around with websockets with the ultimate goal of building a web importer frontend for the beets importer process. Currently I'm trying to get a proof of concept to work using Flask-SocketIO with eventlet. For this it's necessary to monkey patch several stdlib modules to 'green' them so they're compatible with eventlet.
However, when I perform the monkey patch I get an error:
```
queues = [CountedQueue(queue_size) for i in range(queue_count)]
File "/opt/cucumba/venv/lib/python3.6/site-packages/beets/util/pipeline.py", line 95, in __init__
queue.Queue.__init__(self, maxsize)
File "/opt/cucumba/venv/lib/python3.6/site-packages/eventlet/green/Queue.py", line 15, in __init__
super(Queue, self).__init__(maxsize)
TypeError: super(type, obj): obj must be an instance or subtype of type
```
After some analysis and trial and error, I got things to work by altering the init method of `CountedQueue` in pipeline.py:
```diff
95c95
< queue.Queue.__init__(self, maxsize)
---
> super(CountedQueue, self).__init__(maxsize)
```
That's nice, but I have a few questions still:
1. Is there any good reason why the `super()` call was not used in the first place, as seems general practice in the file (and community?)
2. I honestly still don't precisely understand the exact differences in the original call and my replaced `super()` call. Could someone elaborate on that?
3. I don't understand why the original situation leads to the specific error.
4. Is this adjustment okay for the pipeline (somewhere in the future)?
Trying to learn and contribute :).
Thanks,
Bart
Contributor guide
Assessment
This issue has not been assessed yet.