vaphes / pocketbase

PocketBase client SDK for python
https://pypi.org/project/pocketbase/
MIT License
332 stars 38 forks source link

unsubscribe does not work in RealtimeService #45

Closed m29h closed 1 year ago

m29h commented 1 year ago

calling unsubscribe in RecordService leads to an AttributeError in https://github.com/vaphes/pocketbase/blob/82a5b3905a568937d123b7ef307194aa135eee57/pocketbase/services/record_service.py#L88

Because the RealtimeService does not implement a method subscribe_by_prefix. This seems to be a typo as it should instead call unsubscribe_by_prefix.

However fixing this locally gives me a followup error in https://github.com/vaphes/pocketbase/blob/82a5b3905a568937d123b7ef307194aa135eee57/pocketbase/services/realtime_service.py#L80 because the pop(sub) changes the dictionary within the loop which leads to a RuntimeError: dictionary changed size during iteration