Skip to content

Commit

Permalink
Fixes deprecated count method (#549)
Browse files Browse the repository at this point in the history
* Replaces deprecated count with count_documents

* Uses new re_path instead of url()
  • Loading branch information
Koed00 committed May 1, 2021
1 parent 685691f commit de9ba04
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions django_q/brokers/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def get_collection(self):
return self.connection[Conf.MONGO_DB][self.list_key]

def queue_size(self):
return self.collection.count({"lock": {"$lte": _timeout()}})
return self.collection.count_documents({"lock": {"$lte": _timeout()}})

def lock_size(self):
return self.collection.count({"lock": {"$gt": _timeout()}})
return self.collection.count_documents({"lock": {"$gt": _timeout()}})

def purge_queue(self):
return self.delete_queue()
Expand Down
4 changes: 2 additions & 2 deletions django_q/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf.urls import url
from django.urls import re_path
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
re_path(r'^admin/', admin.site.urls),
]

0 comments on commit de9ba04

Please sign in to comment.