mitmedialab / django-channels-presence

"Rooms" and "Presence" for django-channels
MIT License
79 stars 38 forks source link

prune_presences crash: TypeError: 'NoneType' object is not iterable #5

Closed rwillmer closed 4 years ago

rwillmer commented 7 years ago
  File "ve3/lib/python3.5/site-packages/channels_presence/management/commands/prune_presences.py", line 6, in handle
    Room.objects.prune_presences()
  File "ve3/lib/python3.5/site-packages/channels_presence/models.py", line 55, in prune_presences
    room.prune_presences(age)
  File "ve3/lib/python3.5/site-packages/channels_presence/models.py", line 100, in prune_presences
    last_seen__lt=now() - timedelta(seconds=age_in_seconds)
TypeError: 'NoneType' object is not utterable
rwillmer commented 7 years ago

The code is trying to cast (num_deleted, num_per_type) from the result of a filter().delete() operation.

yourcelf commented 7 years ago

Sounds like you're using a Django < 1.9. The return value was changed in Django 1.9: https://docs.djangoproject.com/en/1.10/ref/models/querysets/#django.db.models.query.QuerySet.delete . At this point, I'm not excited about maintaining support for Django 1.8 and below -- but I'd welcome a pull request if you'd like to add support without reducing performance on Django 1.9+.