pinax / pinax-notifications

user notification management for the Django web framework
MIT License
752 stars 211 forks source link

emit_notices management command and send_all have several errors #76

Open ashishbb opened 7 years ago

ashishbb commented 7 years ago

I've just recently started experimenting with emit_notices in pinax-notifications and I have been facing several issues. I am unsure if I am running something incorrectly.

When I run emit_notices management command, I immediately receive the error :

  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Python27\lib\site-packages\django\core\management\base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "C:\Python27\lib\site-packages\pinax\notifications\management\commands\emit_notices.py", line 14, in handle
    send_all(*args)
  File "C:\Python27\lib\site-packages\pinax\notifications\engine.py", line 41, in send_all
    lock = acquire_lock(*args)
  File "C:\Python27\lib\site-packages\pinax\notifications\engine.py", line 29, in acquire_lock
    lock.acquire(settings.PINAX_NOTIFICATIONS_LOCK_WAIT_TIMEOUT)
  File "C:\Python27\lib\site-packages\pinax\notifications\lockfile.py", line 354, in acquire
    self.attempt_acquire(self, timeout, end_time, wait)
TypeError: attempt_acquire() takes exactly 4 arguments (5 given)

This error is seems to be due to "self" being passed in to another class method when I believe "self" is passed in to all methods by default by the class so "self" gets passed twice.

If I remove "self" from being passed into "attempt_acquire" in lockfile.py, line 354, the lockfile gets stuck in the while loop in lockfile.py, line 353 and loops infinitely even after a lockfile is created.

while True:
    self.attempt_acquire(timeout, end_time, wait)

Note : I am using PINAX_NOTIFICATIONS_LOCK_WAIT_TIMEOUT = -1 (default). I have also tried setting it to 1, but the lock is never acquired either way.

And finally, I faced this issue as well.

Am I doing something wrong here? I am currently using Windows 10 with Python 2.7 but I have also tried with Linux machines and got the same results (I have not tried Python 3.x). Pinax packages have always been very solid for me so I am surprised about all the problems I am facing with emit_notices.

Any help is appreciated! Thank you.